Skip to content

fix(authenticator): Move autoSignIn logic out of signUp actor #1910

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

Merged
merged 15 commits into from
May 20, 2022

Conversation

wlee221
Copy link
Contributor

@wlee221 wlee221 commented May 17, 2022

Description of changes

Previously, autoSignIn flow was part of the signUp actor. But autoSignIn is quite incomplete compared to what signIn actor does; autoSignIn only tries Auth.signIn and does not check for any auth challenges or edge cases like sms mfa, totp, etc.

Instead of having incomplete autoSignIn in signUp actor, this moves autoSignIn to signIn actor. This makes semantic sense, because autoSignIn is part of sign in flow anyway and signUp actor should only be dealing with sign up logic.

Issue #, if available

Fixes #1660.

Description of how you validated changes

I confirmed manually that end-users are be automatically redirected to confirmSignIn after confirm sign up.

Also added new e2e test that goes through this process.

Checklist

  • PR description included
  • yarn test passes
  • Tests are updated
  • No side effects or sideEffects field updated
  • Relevant documentation is changed or added (and PR referenced)

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

This should fail because we aren't setting intents yet.
@changeset-bot
Copy link

changeset-bot bot commented May 17, 2022

🦋 Changeset detected

Latest commit: f6d95ff

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

This PR includes changesets to release 4 packages
Name Type
@aws-amplify/ui-react Patch
@aws-amplify/ui Patch
@aws-amplify/ui-vue Patch
@aws-amplify/ui-angular 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

@lgtm-com

This comment was marked as duplicate.

@wlee221 wlee221 temporarily deployed to ci May 17, 2022 01:32 Inactive
@wlee221 wlee221 temporarily deployed to ci May 17, 2022 01:32 Inactive
@wlee221 wlee221 temporarily deployed to ci May 17, 2022 01:32 Inactive
@wlee221 wlee221 temporarily deployed to ci May 17, 2022 01:32 Inactive
@lgtm-com

This comment was marked as duplicate.

@lgtm-com

This comment was marked as duplicate.

@lgtm-com

This comment was marked as duplicate.

@lgtm-com

This comment was marked as spam.

@wlee221 wlee221 force-pushed the autosignin-refactor branch from ab20b2a to f0d954e Compare May 19, 2022 01:12
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 01:25 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 01:25 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 01:25 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 01:25 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 02:10 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 02:10 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 02:10 Inactive
@wlee221 wlee221 changed the title fix(authenticator): move autoSignIn logic to signIn actor fix(authenticator): move autoSignIn logic to signIn actor May 19, 2022
@wlee221 wlee221 changed the title fix(authenticator): move autoSignIn logic to signIn actor fix(authenticator): move autoSignIn logic to signIn actor May 19, 2022
@wlee221 wlee221 changed the title fix(authenticator): move autoSignIn logic to signIn actor fix(authenticator): Move autoSignIn logic out of signUp actor` May 19, 2022
@wlee221 wlee221 changed the title fix(authenticator): Move autoSignIn logic out of signUp actor` fix(authenticator): Move autoSignIn logic out of signUp actor May 19, 2022
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 02:36 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 02:36 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 02:36 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 02:36 Inactive
@@ -373,6 +374,7 @@ export function createAuthenticatorMachine() {
event.data?.intent === 'confirmSignUp',
shouldRedirectToResetPassword: (_, event) =>
event.data?.intent === 'confirmPasswordReset',
shouldAutoSignIn: (_, event) => event.data?.intent === 'autoSignIn',
Copy link
Contributor Author

@wlee221 wlee221 May 19, 2022

Choose a reason for hiding this comment

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

I realize after few months that intent is a bad name. Really what intent is the redirectTarget.

e.g. { intent: 'autoSignIn' } means that authenticator should go to autoSignIn state next.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -16,6 +16,7 @@ const getRouteComponent = (route: string) => {
case 'authenticated':
case 'idle':
case 'setup':
case 'autoSignIn':
Copy link
Contributor

@ErikCH ErikCH May 19, 2022

Choose a reason for hiding this comment

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

We might need to add this case for Vue an Angular too. I noticed an unusual visual regression where after you enter your code in the confirm sign up page and click submit, a new floating bar at the top appears for a second or two before the authenticated page appears. It also occurs at sign out.

image

This only happens for Angular and Vue.

Otherwise looks good. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! That's been frustrating to me. I'll create a new PR that targets this branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1937 up!

Co-authored-by: Shane Laymance <shane.laymance@gmail.com>
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 18:32 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 18:32 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 18:32 Inactive
@wlee221 wlee221 temporarily deployed to ci May 19, 2022 18:32 Inactive
Copy link
Contributor

@ErikCH ErikCH left a comment

Choose a reason for hiding this comment

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

Just had the comment about fixing the floating line, during sign up. Otherwise looks good.

@wlee221 wlee221 merged commit 766bf30 into main May 20, 2022
@wlee221 wlee221 deleted the autosignin-refactor branch May 20, 2022 17:59
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.

Unhandled Authenticator Route - Please open an issue: null
3 participants