Skip to content

Commit

Permalink
chore: change the name of the sign in step to make it more broad for …
Browse files Browse the repository at this point in the history
…passwordless
  • Loading branch information
khatruong2009 committed Oct 24, 2024
1 parent b5f6dcb commit 3055a3a
Show file tree
Hide file tree
Showing 26 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion packages/amplify_core/doc/lib/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Future<void> _handleSignInResult(SignInResult result) async {
_handleCodeDelivery(codeDeliveryDetails);
// #enddocregion handle-confirm-signin-sms
// #docregion handle-confirm-signin-email
case AuthSignInStep.confirmSignInWithEmailMfaCode:
case AuthSignInStep.confirmSignInWithOtpCode:
final codeDeliveryDetails = result.nextStep.codeDeliveryDetails!;
_handleCodeDelivery(codeDeliveryDetails);
// #enddocregion handle-confirm-signin-email
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum AuthSignInStep {
confirmSignInWithTotpMfaCode,

/// The sign-in is not complete and must be confirmed with an email code.
confirmSignInWithEmailMfaCode,
confirmSignInWithOtpCode,

/// The sign-in is not complete and must be confirmed with the user's new
/// password.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);

final confirmRes = await Amplify.Auth.confirmSignIn(
confirmationValue: await otpResult.code,
Expand All @@ -63,7 +63,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -353,7 +353,7 @@ void main() {
confirmationValue: 'EMAIL',
);
check(selectRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(selectRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -392,7 +392,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void main() {
signInRes.nextStep.signInStep,
because:
'When an email is registered and the userpool has email MFA enabled, Cognito will automatically enable email MFA as the preferred MFA method.',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);

final setupRes = await Amplify.Auth.confirmSignIn(
confirmationValue: await otpResult.code,
Expand All @@ -60,7 +60,7 @@ void main() {
password: password,
);
check(resignInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(resignInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -98,7 +98,7 @@ void main() {
signInRes.nextStep.signInStep,
because:
'MFA is required so Cognito automatically enables EMAIL MFA',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);

final confirmRes = await Amplify.Auth.confirmSignIn(
confirmationValue: await otpResult.code,
Expand Down Expand Up @@ -224,7 +224,7 @@ void main() {
check(
signInRes.nextStep.signInStep,
because: 'Preference is EMAIL MFA now',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void main() {
signInRes.nextStep.signInStep,
because: 'Once Email MFA is preferred, it is performed '
'on every sign-in attempt.',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -155,7 +155,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -386,7 +386,7 @@ void main() {
);

check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void main() {
signInRes.nextStep.signInStep,
because: 'MFA is required, and EMAIL is chosen when '
'no phone number is registered',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);

final setupRes = await Amplify.Auth.confirmSignIn(
confirmationValue: await otpResult.code,
Expand All @@ -68,7 +68,7 @@ void main() {
password: password,
);
check(resignInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(resignInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -147,7 +147,7 @@ void main() {
check(
resignInRes.nextStep.signInStep,
because: 'Preference is EMAIL MFA now',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);
check(resignInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -300,7 +300,7 @@ void main() {
check(
signInRes.nextStep.signInStep,
because: 'Preference is EMAIL MFA now',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class CognitoConstants {
static const challengeParamSmsMfaCode = 'SMS_MFA_CODE';

/// The `EMAIL_OTP_CODE` parameter.
static const challengeParamEmailMfaCode = 'EMAIL_OTP_CODE';
static const challengeParamEmailOtpCode = 'EMAIL_OTP_CODE';

/// The `SOFTWARE_TOKEN_MFA_CODE` parameter.
static const challengeParamSoftwareTokenMfaCode = 'SOFTWARE_TOKEN_MFA_CODE';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension ChallengeNameTypeBridge on ChallengeNameType {
ChallengeNameType.softwareTokenMfa =>
AuthSignInStep.confirmSignInWithTotpMfaCode,
ChallengeNameType.emailOtp =>
AuthSignInStep.confirmSignInWithEmailMfaCode,
AuthSignInStep.confirmSignInWithOtpCode,
ChallengeNameType.adminNoSrpAuth ||
ChallengeNameType.passwordVerifier ||
ChallengeNameType.devicePasswordVerifier ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ void main() {
tester.bloc.stream,
emitsInOrder([
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
emitsDone,
]),
Expand All @@ -62,7 +62,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the email MFA code page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// And I type a valid EMAIL OTP code
await confirmSignInPage.enterVerificationCode(await otpResult.code);
Expand Down Expand Up @@ -94,7 +94,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the EMAIL OTP code page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid EMAIL OTP code
await confirmSignInPage.enterVerificationCode(await otpResult2.code);
Expand Down Expand Up @@ -129,7 +129,7 @@ void main() {
tester.bloc.stream,
emitsInOrder([
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
emitsDone,
]),
);
Expand All @@ -147,7 +147,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the EMAIL OTP code page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// And I type an invalid confirmation code
await confirmSignInPage.enterVerificationCode('123456');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void main() {
tester.bloc.stream,
emitsInOrder([
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
UnauthenticatedState.signIn,
isA<ContinueSignInWithMfaSelection>(),
Expand All @@ -61,7 +61,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the confirm email mfa page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid confirmation code
await confirmSignInPage.enterVerificationCode(await otpResult.code);
Expand Down Expand Up @@ -138,11 +138,11 @@ void main() {
tester.bloc.stream,
emitsInOrder([
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
UnauthenticatedState.signIn,
isA<ContinueSignInWithMfaSelection>(),
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
emitsDone,
]),
Expand All @@ -163,7 +163,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the confirm email mfa page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid confirmation code
await confirmSignInPage.enterVerificationCode(await otpResult.code);
Expand Down Expand Up @@ -205,7 +205,7 @@ void main() {
await confirmSignInPage.submitConfirmSignInMfaSelection();

// Then I will be redirected to the confirm EMAIL mfa page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid confirmation code
await confirmSignInPage.enterVerificationCode(await otpResult2.code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void main() {
UnauthenticatedState.confirmSignInMfa,
isA<AuthenticatedState>(),
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
emitsDone,
]),
Expand Down Expand Up @@ -101,7 +101,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the EMAIL MFA code page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid EMAIL MFA code
await confirmSignInPage.enterVerificationCode(await code_2.code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void main() {
UnauthenticatedState.signIn,
isA<ContinueSignInWithMfaSetupSelection>(),
UnauthenticatedState.continueSignInWithEmailMfaSetup,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
emitsDone,
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ class _AuthenticatorState extends State<Authenticator> {
continueSignInWithEmailMfaSetupForm:
ContinueSignInWithEmailMfaSetupForm(),
confirmSignInWithTotpMfaCodeForm: ConfirmSignInMFAForm(),
confirmSignInWithEmailMfaCodeForm: ConfirmSignInMFAForm(),
confirmSignInWithOtpCodeForm: ConfirmSignInMFAForm(),
verifyUserForm: VerifyUserForm(),
confirmVerifyUserForm: ConfirmVerifyUserForm(),
child: widget.child,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ class StateMachineBloc
yield UnauthenticatedState.confirmSignInNewPassword;
case AuthSignInStep.confirmSignInWithTotpMfaCode:
yield UnauthenticatedState.confirmSignInWithTotpMfaCode;
case AuthSignInStep.confirmSignInWithEmailMfaCode:
yield UnauthenticatedState.confirmSignInWithEmailMfaCode;
case AuthSignInStep.confirmSignInWithOtpCode:
yield UnauthenticatedState.confirmSignInWithOtpCode;
case AuthSignInStep.continueSignInWithMfaSelection:
yield ContinueSignInWithMfaSelection(
allowedMfaTypes: result.nextStep.allowedMfaTypes,
Expand Down Expand Up @@ -345,9 +345,9 @@ class StateMachineBloc
_emit(UnauthenticatedState.continueSignInWithEmailMfaSetup);
case AuthSignInStep.confirmSignInWithTotpMfaCode:
_emit(UnauthenticatedState.confirmSignInWithTotpMfaCode);
case AuthSignInStep.confirmSignInWithEmailMfaCode:
case AuthSignInStep.confirmSignInWithOtpCode:
_notifyCodeSent(result.nextStep.codeDeliveryDetails?.destination);
_emit(UnauthenticatedState.confirmSignInWithEmailMfaCode);
_emit(UnauthenticatedState.confirmSignInWithOtpCode);
case AuthSignInStep.resetPassword:
_emit(UnauthenticatedState.confirmResetPassword);
case AuthSignInStep.confirmSignUp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ enum AuthenticatorStep {
confirmSignInWithTotpMfaCode,

/// The sign-in is not complete and must be confirmed with an email code.
confirmSignInWithEmailMfaCode,
confirmSignInWithOtpCode,

/// The user is on the Reset Password step.
resetPassword,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ abstract class AuthenticatorTitleLocalizations {
///
/// In en, this message translates to:
/// **'Enter your one-time passcode'**
String get confirmSignInWithEmailMfaCode;
String get confirmSignInWithOtpCode;

/// Title of the Continue Sign In with Email MFA Setup step and form
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AuthenticatorTitleLocalizationsEn
String get confirmSignInWithTotpMfaCode => 'Enter your one-time passcode';

@override
String get confirmSignInWithEmailMfaCode => 'Enter your one-time passcode';
String get confirmSignInWithOtpCode => 'Enter your one-time passcode';

@override
String get continueSignInWithEmailMfaSetup =>
Expand Down
Loading

0 comments on commit 3055a3a

Please sign in to comment.