Skip to content
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(authenticator): propagate username from signUp actor to top level machine #4923

Merged
merged 5 commits into from
Jan 22, 2024

Conversation

calebpollman
Copy link
Member

Description of changes

Fix Setup Totp route QR code rendering in Vue and computed totpCodeUrl values used in Vue, Angular, and React Authenticator implementations

  • username to top level machine from signUpActor.resolved state
  • remove extraneous reactivity from static values and truthy checks in setup-totp.vue
  • remove no longer relevant unit test for setup-totp.spec.ts

Issue #, if available

Fixes #4919

Description of how you validated changes

  • manual testing of QR code generation in Vue, Angular and React
  • local e2e test runs
  • verified that username value is read correctly from the QR code using a QR code reader

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@calebpollman calebpollman requested a review from a team as a code owner January 18, 2024 22:56
Copy link

changeset-bot bot commented Jan 18, 2024

🦋 Changeset detected

Latest commit: efa1407

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@aws-amplify/ui Patch
@aws-amplify/ui-vue Patch
@aws-amplify/ui-react-auth Patch
@aws-amplify/ui-react-core-auth Patch
@aws-amplify/ui-react-core-notifications Patch
@aws-amplify/ui-react-core Patch
@aws-amplify/ui-react-liveness Patch
@aws-amplify/ui-react-native-auth Patch
@aws-amplify/ui-react-native Patch
@aws-amplify/ui-react-notifications Patch
@aws-amplify/ui-react-storage Patch
@aws-amplify/ui-react Patch
@aws-amplify/ui-angular Patch
@aws-amplify/ui-react-geo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -18,15 +18,13 @@ const logger = new Logger('SetupTotp-logger');

// `facade` is manually typed to `UseAuthenticator` for temporary type safety.
const facade: UseAuthenticator = useAuthenticator();
const { updateForm, submitForm, toSignIn } = facade;
const { error, isPending, QRFields, totpSecretCode, username } = toRefs(facade);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QRFields, totpSecretCode, username are static values and do not require reactivity

Comment on lines -27 to +28
const totpCodeURL = totpSecretCode.value
? getTotpCodeURL(totpIssuer, totpUsername!, totpSecretCode.value)
: null;
// `totpSecretCode` is typed as `string | null` but will always be populated by the machine here
const totpCodeURL = getTotpCodeURL(totpIssuer, totpUsername, totpSecretCode!);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Truthiness check of totpSecretCode.value is no longer needed. Before migrating to [email protected] the totpSecretCode value needed to be generated by an additional async call, this check was a remnant of the previously required handling.

totpSecretCode is now provided directly via the state machine from the payload of a successful call to signIn, signUp, or confirmSignUp depending on the end user's current account status

@calebpollman calebpollman merged commit d61690d into main Jan 22, 2024
31 checks passed
@calebpollman calebpollman deleted the authenticator/propagate-machine-username branch January 22, 2024 22:01
@github-actions github-actions bot mentioned this pull request Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When I sign up account MFA qr code always show ''Loading...''
3 participants