Email verification for new devices #1931
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Objective
Given: a user does not have 2FA set up AND the user is not logging in with SSO
When: the user logs in on a new device AND this is not the first device the user has logged in on
Then: required Email 2FA
Code changes
SendTwoFactorEmailAsyncTesting requirements
Test that on users that don't have SSO and don't have any 2FA set up, when login in new devices a 2FA is required and an email is received with the 2FA token and explaining why they are receiving that.
This shouldn't happen if the user has any 2FA set up or if they are login in with SSO.
Additional notes
Maybe it'd be a good idea to refactor the
TwoFactorProviderset up to be done in some other object like a factory or a static method (or extension method) that builds the provider given the type and some additional arguments. On what I did I just copied the EmailKeyValuePair<TwoFactorProviderType, TwoFactorProvider>as I saw it was done on other parts just not to refactor the other parts and tackle that all at once with some planning beforehand given that it may break core stuff.Before you submit
dotnet tool run dotnet-format --check) (required)