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

FND 1264 - restrict silent takeover scenarios #36716

Merged
merged 5 commits into from Sep 25, 2020
Merged

Conversation

bethanyaconnor
Copy link
Contributor

@bethanyaconnor bethanyaconnor commented Sep 11, 2020

See the JIRA ticket for more info.

This PR limits silent takeover cases to only when the the account being taken over already has a trusted authentication option.

In other cases, when a user tries to sign up, they'll see

Screenshot 2020-09-11 at 12 35 00 PM

Links

Testing story

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@bethanyaconnor bethanyaconnor changed the title FND 1264 FND 1264 - restrict silent takeover scenarios Sep 11, 2020
@dju90
Copy link
Contributor

dju90 commented Sep 11, 2020

Wondering if we should add a reset password link on this page directly, similar to what we have on the sign in page,
image
to account for users that think "wait, I don't remember creating an account"
^ this would be easy to do, right?

if allows_silent_takeover(user, auth_hash)
user = silent_takeover user, auth_hash
sign_in_user user
if email_already_taken(user)
Copy link
Contributor

Choose a reason for hiding this comment

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

won't this new conditional break the one below it?

elsif (looked_up_user = User.find_by_email_or_hashed_email(user.email))
email_already_taken_redirect \
provider: provider,
found_provider: looked_up_user.provider,
email: user.email

lookup_user = User.find_by_email_or_hashed_email(oauth_user.email)
verified_email_credentials = AuthenticationOption::TRUSTED_EMAIL_CREDENTIAL_TYPES - [AuthenticationOption::EMAIL]

lookup_user = AuthenticationOption.where(credential_type: verified_email_credentials).find_by(hashed_email: User.hash_email(oauth_user.email))&.user || User.where(hashed_email: User.hash_email(oauth_user.email)).where(provider: verified_email_credentials).first
Copy link
Contributor

Choose a reason for hiding this comment

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

[i know this is a draft, so excuse the nit] we should break this into multiple lines for readability and so that we only need to look up the User once

@bethanyaconnor bethanyaconnor marked this pull request as ready for review September 14, 2020 18:38
Copy link
Contributor

@maddiedierker maddiedierker left a comment

Choose a reason for hiding this comment

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

LGTM! i also wouldn't mind if we stopped supporting silent takeover altogether 😈

@bethanyaconnor bethanyaconnor merged commit 5953467 into staging Sep 25, 2020
@bethanyaconnor bethanyaconnor deleted the fnd-1264-take2 branch September 25, 2020 22:46
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.

None yet

3 participants