diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 79cc4e0858..d4f33ab4c7 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -146,7 +146,7 @@ Future _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 diff --git a/packages/amplify_core/lib/src/types/auth/sign_in/auth_next_sign_in_step.g.dart b/packages/amplify_core/lib/src/types/auth/sign_in/auth_next_sign_in_step.g.dart index addf8e6b35..6d480f1414 100644 --- a/packages/amplify_core/lib/src/types/auth/sign_in/auth_next_sign_in_step.g.dart +++ b/packages/amplify_core/lib/src/types/auth/sign_in/auth_next_sign_in_step.g.dart @@ -82,7 +82,7 @@ const _$AuthSignInStepEnumMap = { 'continueSignInWithEmailMfaSetup', AuthSignInStep.confirmSignInWithSmsMfaCode: 'confirmSignInWithSmsMfaCode', AuthSignInStep.confirmSignInWithTotpMfaCode: 'confirmSignInWithTotpMfaCode', - AuthSignInStep.confirmSignInWithEmailMfaCode: 'confirmSignInWithEmailMfaCode', + AuthSignInStep.confirmSignInWithOtpCode: 'confirmSignInWithOtpCode', AuthSignInStep.confirmSignInWithNewPassword: 'confirmSignInWithNewPassword', AuthSignInStep.confirmSignInWithCustomChallenge: 'confirmSignInWithCustomChallenge', diff --git a/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart b/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart index eef001a650..e63cb3a58f 100644 --- a/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart +++ b/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart @@ -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. diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_optional_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_optional_test.dart index 9762aa9d58..0fed40593b 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_optional_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_optional_test.dart @@ -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') diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_required_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_required_test.dart index f0aed4cd87..5cd4809ad6 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_required_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_required_test.dart @@ -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, @@ -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') diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_totp_optional_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_totp_optional_test.dart index 97f46ff4b8..16a9987e1c 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_totp_optional_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_totp_optional_test.dart @@ -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') @@ -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') @@ -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') diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_totp_required_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_totp_required_test.dart index 514cc9c53e..b7f49da0e6 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_totp_required_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_email_totp_required_test.dart @@ -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, @@ -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') @@ -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, @@ -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') diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_email_optional_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_email_optional_test.dart index ec45284a6a..4be77b4f06 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_email_optional_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_email_optional_test.dart @@ -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') @@ -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') @@ -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') diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_email_required_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_email_required_test.dart index 0aa4871021..6a3da16919 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_email_required_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_email_required_test.dart @@ -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, @@ -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') @@ -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') @@ -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') diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_username_login_required_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_username_login_required_test.dart index edbb8ce43f..9903ed6e2d 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_username_login_required_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_username_login_required_test.dart @@ -72,7 +72,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') @@ -199,7 +199,7 @@ void main() { ); check(resignInRes.nextStep.signInStep) - .equals(AuthSignInStep.confirmSignInWithEmailMfaCode); + .equals(AuthSignInStep.confirmSignInWithOtpCode); check(resignInRes.nextStep.codeDeliveryDetails) .isNotNull() .has((d) => d.deliveryMedium, 'deliveryMedium') diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart index 361ac6ccb8..174bf2c9bf 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart @@ -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'; diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index a48c8d4a01..f181767b99 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -33,7 +33,7 @@ extension ChallengeNameTypeBridge on ChallengeNameType { ChallengeNameType.softwareTokenMfa => AuthSignInStep.confirmSignInWithTotpMfaCode, ChallengeNameType.emailOtp => - AuthSignInStep.confirmSignInWithEmailMfaCode, + AuthSignInStep.confirmSignInWithOtpCode, ChallengeNameType.adminNoSrpAuth || ChallengeNameType.passwordVerifier || ChallengeNameType.devicePasswordVerifier || diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 2fdb6c66af..61a725e683 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -327,7 +327,7 @@ final class SignInStateMachine ChallengeNameType.softwareTokenMfa when hasUserResponse => createSoftwareTokenMfaRequest(event), ChallengeNameType.emailOtp when hasUserResponse => - createEmailMfaRequest(event), + createEmailOtpRequest(event), ChallengeNameType.selectMfaType when hasUserResponse => createSelectMfaRequest(event), ChallengeNameType.mfaSetup when hasUserResponse => @@ -454,7 +454,7 @@ final class SignInStateMachine /// Creates the response object for an Email MFA challenge. @protected - Future createEmailMfaRequest( + Future createEmailOtpRequest( SignInRespondToChallenge event, ) async { _enableMfaType = MfaType.email; @@ -464,7 +464,7 @@ final class SignInStateMachine ..challengeName = _challengeName ..challengeResponses.addAll({ CognitoConstants.challengeParamUsername: cognitoUsername, - CognitoConstants.challengeParamEmailMfaCode: event.answer, + CognitoConstants.challengeParamEmailOtpCode: event.answer, }) ..clientMetadata.addAll(event.clientMetadata); }); @@ -702,13 +702,13 @@ final class SignInStateMachine // User has provided the verification code return _enableMfaType == MfaType.totp - ? createMfaSetupRequest(event) + ? createTotpMfaSetupRequest(event) : createEmailMfaSetupRequest(event); } /// Completes set up of a TOTP MFA. @protected - Future createMfaSetupRequest( + Future createTotpMfaSetupRequest( SignInRespondToChallenge event, ) async { await verifySoftwareToken( diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_email_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_email_test.dart index 3618170b5f..f7c6986312 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_email_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_email_test.dart @@ -36,10 +36,10 @@ void main() { tester.bloc.stream, emitsInOrder([ UnauthenticatedState.signIn, - UnauthenticatedState.confirmSignInWithEmailMfaCode, + UnauthenticatedState.confirmSignInWithOtpCode, isA(), UnauthenticatedState.signIn, - UnauthenticatedState.confirmSignInWithEmailMfaCode, + UnauthenticatedState.confirmSignInWithOtpCode, isA(), emitsDone, ]), @@ -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); @@ -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); @@ -129,7 +129,7 @@ void main() { tester.bloc.stream, emitsInOrder([ UnauthenticatedState.signIn, - UnauthenticatedState.confirmSignInWithEmailMfaCode, + UnauthenticatedState.confirmSignInWithOtpCode, emitsDone, ]), ); @@ -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'); diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_email_totp_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_email_totp_test.dart index fdb17d628c..fcee99259c 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_email_totp_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_email_totp_test.dart @@ -36,7 +36,7 @@ void main() { tester.bloc.stream, emitsInOrder([ UnauthenticatedState.signIn, - UnauthenticatedState.confirmSignInWithEmailMfaCode, + UnauthenticatedState.confirmSignInWithOtpCode, isA(), UnauthenticatedState.signIn, isA(), @@ -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); @@ -138,11 +138,11 @@ void main() { tester.bloc.stream, emitsInOrder([ UnauthenticatedState.signIn, - UnauthenticatedState.confirmSignInWithEmailMfaCode, + UnauthenticatedState.confirmSignInWithOtpCode, isA(), UnauthenticatedState.signIn, isA(), - UnauthenticatedState.confirmSignInWithEmailMfaCode, + UnauthenticatedState.confirmSignInWithOtpCode, isA(), emitsDone, ]), @@ -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); @@ -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); diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart index d425e94eb2..c01460f6d5 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart @@ -46,7 +46,7 @@ void main() { UnauthenticatedState.confirmSignInMfa, isA(), UnauthenticatedState.signIn, - UnauthenticatedState.confirmSignInWithEmailMfaCode, + UnauthenticatedState.confirmSignInWithOtpCode, isA(), emitsDone, ]), @@ -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); diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_username_login_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_username_login_test.dart index 032f700ed4..823fa1ee51 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_username_login_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_username_login_test.dart @@ -37,7 +37,7 @@ void main() { UnauthenticatedState.signIn, isA(), UnauthenticatedState.continueSignInWithEmailMfaSetup, - UnauthenticatedState.confirmSignInWithEmailMfaCode, + UnauthenticatedState.confirmSignInWithOtpCode, isA(), emitsDone, ]), diff --git a/packages/authenticator/amplify_authenticator/lib/amplify_authenticator.dart b/packages/authenticator/amplify_authenticator/lib/amplify_authenticator.dart index 55abb9c220..81d94d88a8 100644 --- a/packages/authenticator/amplify_authenticator/lib/amplify_authenticator.dart +++ b/packages/authenticator/amplify_authenticator/lib/amplify_authenticator.dart @@ -719,7 +719,7 @@ class _AuthenticatorState extends State { continueSignInWithEmailMfaSetupForm: ContinueSignInWithEmailMfaSetupForm(), confirmSignInWithTotpMfaCodeForm: ConfirmSignInMFAForm(), - confirmSignInWithEmailMfaCodeForm: ConfirmSignInMFAForm(), + confirmSignInWithOtpCodeForm: ConfirmSignInMFAForm(), verifyUserForm: VerifyUserForm(), confirmVerifyUserForm: ConfirmVerifyUserForm(), child: widget.child, diff --git a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index d6b2a435c5..7b29bb2a9c 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -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, @@ -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: diff --git a/packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart b/packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart index 5ef325081a..8fcc406563 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart @@ -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, diff --git a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/title_localizations.dart b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/title_localizations.dart index 852f8e4d7b..abe2edf4ce 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/title_localizations.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/title_localizations.dart @@ -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 /// diff --git a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/title_localizations_en.dart b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/title_localizations_en.dart index 692f579fa5..938f974e9f 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/title_localizations_en.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/title_localizations_en.dart @@ -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 => diff --git a/packages/authenticator/amplify_authenticator/lib/src/l10n/title_resolver.dart b/packages/authenticator/amplify_authenticator/lib/src/l10n/title_resolver.dart index e5c1b19480..318753c227 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/l10n/title_resolver.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/l10n/title_resolver.dart @@ -50,9 +50,9 @@ class TitleResolver extends Resolver { } /// The title for the confirm sign in (email MFA code) Widget. - String confirmSignInWithEmailMfaCode(BuildContext context) { + String confirmSignInWithOtpCode(BuildContext context) { return AuthenticatorLocalizations.titlesOf(context) - .confirmSignInWithEmailMfaCode; + .confirmSignInWithOtpCode; } /// The title for the continue sign in (email MFA setup) Widget. @@ -99,8 +99,8 @@ class TitleResolver extends Resolver { return continueSignInWithTotpSetup(context); case AuthenticatorStep.confirmSignInWithTotpMfaCode: return confirmSignInWithTotpMfaCode(context); - case AuthenticatorStep.confirmSignInWithEmailMfaCode: - return confirmSignInWithEmailMfaCode(context); + case AuthenticatorStep.confirmSignInWithOtpCode: + return confirmSignInWithOtpCode(context); case AuthenticatorStep.continueSignInWithEmailMfaSetup: return continueSignInWithEmailMfaSetup(context); case AuthenticatorStep.continueSignInWithMfaSetupSelection: diff --git a/packages/authenticator/amplify_authenticator/lib/src/screens/authenticator_screen.dart b/packages/authenticator/amplify_authenticator/lib/src/screens/authenticator_screen.dart index e405a6a812..2524d2cb35 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/screens/authenticator_screen.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/screens/authenticator_screen.dart @@ -40,8 +40,8 @@ class AuthenticatorScreen extends StatelessAuthenticatorComponent { const AuthenticatorScreen.confirmSignInWithTotpMfaCode({Key? key}) : this(key: key, step: AuthenticatorStep.confirmSignInWithTotpMfaCode); - const AuthenticatorScreen.confirmSignInWithEmailMfaCode({Key? key}) - : this(key: key, step: AuthenticatorStep.confirmSignInWithEmailMfaCode); + const AuthenticatorScreen.confirmSignInWithOtpCode({Key? key}) + : this(key: key, step: AuthenticatorStep.confirmSignInWithOtpCode); const AuthenticatorScreen.continueSignInWithEmailMfaSetup({Key? key}) : this(key: key, step: AuthenticatorStep.continueSignInWithEmailMfaSetup); @@ -103,7 +103,7 @@ class AuthenticatorScreen extends StatelessAuthenticatorComponent { case AuthenticatorStep.confirmResetPassword: case AuthenticatorStep.verifyUser: case AuthenticatorStep.confirmVerifyUser: - case AuthenticatorStep.confirmSignInWithEmailMfaCode: + case AuthenticatorStep.confirmSignInWithOtpCode: case AuthenticatorStep.continueSignInWithEmailMfaSetup: case AuthenticatorStep.continueSignInWithMfaSetupSelection: child = _FormWrapperView(step: step); @@ -314,7 +314,7 @@ extension on AuthenticatorStep { case AuthenticatorStep.verifyUser: case AuthenticatorStep.confirmVerifyUser: case AuthenticatorStep.loading: - case AuthenticatorStep.confirmSignInWithEmailMfaCode: + case AuthenticatorStep.confirmSignInWithOtpCode: case AuthenticatorStep.continueSignInWithEmailMfaSetup: case AuthenticatorStep.continueSignInWithMfaSetupSelection: throw StateError('Invalid step: $this'); diff --git a/packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart b/packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart index 834afbe683..ed4d213700 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart @@ -49,8 +49,8 @@ class UnauthenticatedState extends AuthState static const continueSignInWithEmailMfaSetup = UnauthenticatedState( step: AuthenticatorStep.continueSignInWithEmailMfaSetup, ); - static const confirmSignInWithEmailMfaCode = UnauthenticatedState( - step: AuthenticatorStep.confirmSignInWithEmailMfaCode, + static const confirmSignInWithOtpCode = UnauthenticatedState( + step: AuthenticatorStep.confirmSignInWithOtpCode, ); static const resetPassword = UnauthenticatedState(step: AuthenticatorStep.resetPassword); diff --git a/packages/authenticator/amplify_authenticator/lib/src/state/inherited_forms.dart b/packages/authenticator/amplify_authenticator/lib/src/state/inherited_forms.dart index 2b75184038..12717df25b 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/state/inherited_forms.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/state/inherited_forms.dart @@ -20,7 +20,7 @@ class InheritedForms extends InheritedWidget { required this.continueSignInWithTotpSetupForm, required this.continueSignInWithEmailMfaSetupForm, required this.confirmSignInWithTotpMfaCodeForm, - required this.confirmSignInWithEmailMfaCodeForm, + required this.confirmSignInWithOtpCodeForm, required this.verifyUserForm, required this.confirmVerifyUserForm, required super.child, @@ -38,7 +38,7 @@ class InheritedForms extends InheritedWidget { final ContinueSignInWithTotpSetupForm continueSignInWithTotpSetupForm; final ContinueSignInWithEmailMfaSetupForm continueSignInWithEmailMfaSetupForm; final ConfirmSignInMFAForm confirmSignInWithTotpMfaCodeForm; - final ConfirmSignInMFAForm confirmSignInWithEmailMfaCodeForm; + final ConfirmSignInMFAForm confirmSignInWithOtpCodeForm; final ResetPasswordForm resetPasswordForm; final ConfirmResetPasswordForm confirmResetPasswordForm; final VerifyUserForm verifyUserForm; @@ -70,8 +70,8 @@ class InheritedForms extends InheritedWidget { return confirmSignInWithTotpMfaCodeForm; case AuthenticatorStep.continueSignInWithEmailMfaSetup: return continueSignInWithEmailMfaSetupForm; - case AuthenticatorStep.confirmSignInWithEmailMfaCode: - return confirmSignInWithEmailMfaCodeForm; + case AuthenticatorStep.confirmSignInWithOtpCode: + return confirmSignInWithOtpCodeForm; case AuthenticatorStep.resetPassword: return resetPasswordForm; case AuthenticatorStep.confirmResetPassword: @@ -118,8 +118,8 @@ class InheritedForms extends InheritedWidget { continueSignInWithTotpSetupForm || oldWidget.confirmSignInWithTotpMfaCodeForm != confirmSignInWithTotpMfaCodeForm || - oldWidget.confirmSignInWithEmailMfaCodeForm != - confirmSignInWithEmailMfaCodeForm || + oldWidget.confirmSignInWithOtpCodeForm != + confirmSignInWithOtpCodeForm || oldWidget.continueSignInWithEmailMfaSetupForm != continueSignInWithEmailMfaSetupForm || oldWidget.continueSignInWithMfaSetupSelectionForm != diff --git a/packages/authenticator/amplify_authenticator/lib/src/widgets/form_field.dart b/packages/authenticator/amplify_authenticator/lib/src/widgets/form_field.dart index cc538d7dc8..83f862044e 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/widgets/form_field.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/widgets/form_field.dart @@ -231,7 +231,7 @@ abstract class AuthenticatorFormFieldState< state.confirmSignInCustomAuth(); case AuthenticatorStep.confirmSignInMfa: state.confirmSignInMFA(); - case AuthenticatorStep.confirmSignInWithEmailMfaCode: + case AuthenticatorStep.confirmSignInWithOtpCode: state.confirmEmailMfa(); case AuthenticatorStep.confirmSignInNewPassword: state.confirmSignInNewPassword(); diff --git a/packages/authenticator/amplify_authenticator_test/lib/src/pages/confirm_sign_in_page.dart b/packages/authenticator/amplify_authenticator_test/lib/src/pages/confirm_sign_in_page.dart index 833713a476..5d2d352509 100644 --- a/packages/authenticator/amplify_authenticator_test/lib/src/pages/confirm_sign_in_page.dart +++ b/packages/authenticator/amplify_authenticator_test/lib/src/pages/confirm_sign_in_page.dart @@ -75,13 +75,13 @@ class ConfirmSignInPage extends AuthenticatorPage { } /// Then I see "Enter your one-time passcode for Email" - Future expectConfirmSignInWithEmailMfaCodeIsPresent() async { + Future expectConfirmSignInWithOtpCodeIsPresent() async { final currentScreen = tester.widget( find.byType(AuthenticatorScreen), ); expect( currentScreen.step, - equals(AuthenticatorStep.confirmSignInWithEmailMfaCode), + equals(AuthenticatorStep.confirmSignInWithOtpCode), ); }