-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(amplify_authenticator): authenticator phone OR email confirmation #1785
fix(amplify_authenticator): authenticator phone OR email confirmation #1785
Conversation
@@ -178,9 +178,9 @@ Future<void> adminCreateUser( | |||
} | |||
} | |||
|
|||
/// Returns the OTP code for [username]. Must be called before the network call | |||
/// Returns the OTP code for [email]. Must be called before the network call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: The lambdas (for "email" auth and "email OR phone" auth) are set up to use the email address, regardless of what is being used for a "username".
This didn't have to change, but the new tests I added where phone number is the username were a bit confusing to read without the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Reset current username value to align with the current switch state. | ||
String newUsername = useEmail | ||
String newUsername = newUsernameSelection == |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String newUsername = newUsernameSelection == | |
final newUsername = newUsernameSelection == |
SignUpPage signUpPage = SignUpPage(tester: tester); | ||
ConfirmSignUpPage confirmSignUpPage = ConfirmSignUpPage(tester: tester); | ||
SignInPage signInPage = SignInPage(tester: tester); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SignUpPage signUpPage = SignUpPage(tester: tester); | |
ConfirmSignUpPage confirmSignUpPage = ConfirmSignUpPage(tester: tester); | |
SignInPage signInPage = SignInPage(tester: tester); | |
final signUpPage = SignUpPage(tester: tester); | |
final confirmSignUpPage = ConfirmSignUpPage(tester: tester); | |
final signInPage = SignInPage(tester: tester); |
SignUpPage signUpPage = SignUpPage(tester: tester); | ||
ConfirmSignUpPage confirmSignUpPage = ConfirmSignUpPage(tester: tester); | ||
SignInPage signInPage = SignInPage(tester: tester); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SignUpPage signUpPage = SignUpPage(tester: tester); | |
ConfirmSignUpPage confirmSignUpPage = ConfirmSignUpPage(tester: tester); | |
SignInPage signInPage = SignInPage(tester: tester); | |
final signUpPage = SignUpPage(tester: tester); | |
final confirmSignUpPage = ConfirmSignUpPage(tester: tester); | |
final signInPage = SignInPage(tester: tester); |
// Then I see "Sign out" | ||
await signInPage.expectAuthenticated(); | ||
}, | ||
skip: !isMobile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can skip on the group
// Reset current username value to align with the current switch state. | ||
String newUsername = useEmail | ||
String newUsername = newUsernameSelection == | ||
UsernameSelection.email | ||
? state.getAttribute(CognitoUserAttributeKey.email) ?? '' | ||
: state.getAttribute( | ||
CognitoUserAttributeKey.phoneNumber) ?? | ||
''; | ||
state.username = newUsername; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since .username
and .usernameSelection
both trigger rebuilds, I think setting the username first might make more sense?
packages/amplify_authenticator/lib/src/mixins/authenticator_username_field.dart
Show resolved
Hide resolved
…aws-amplify#1785) * fix(authenticator): move username selection state to authenticator state * chore; update imports * test: add integration tests for email or phone configs * chore: move username input enum
…aws-amplify#1785) * fix(authenticator): move username selection state to authenticator state * chore; update imports * test: add integration tests for email or phone configs * chore: move username input enum
…#1785) * fix(authenticator): move username selection state to authenticator state * chore; update imports * test: add integration tests for email or phone configs * chore: move username input enum
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.