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

Extract password view setup behaviors from shared email confirmation behavior #11467

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

aduth
Copy link
Member

@aduth aduth commented Nov 7, 2024

🛠 Summary of changes

Updates shared code for email confirmation token to only be called as needed.

As mentioned in #11466, email confirmation happens across two controllers, which each individually validate the incoming confirmation token. Prior to these changes, the validation included a few things performed in both the initial email confirmation, as well as the password setup screen:

  • Assigning forbidden passwords instance variable
  • Flashing a success message

Since these are only relevant for the display of the password setup screen, the changes here move the code into the password setup controller.

📜 Testing Plan

Verify no regressions of expected behavior:

  1. Go to http://localhost:3000/
  2. Click "Create an account"
  3. Enter the email address [email protected]
  4. Confirm Rules of Use
  5. Click "Submit"
  6. In the email received, click "Confirm email address"
  7. Observe success banner indicating that you've confirmed email address and need to set up password
  8. Try submitting a "forbidden" password [email protected]
  9. Observe that you see an error message

def render_page
render(
:new,
locals: { confirmation_token: @confirmation_token },
Copy link
Member Author

Choose a reason for hiding this comment

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

AFAICT we weren't ever using this locals assignment, since the view references @confirmation_token directly. Locals are intended to be referenced without the @.

@aduth aduth changed the title Extract shared email confirmation behavior as needed Extract password view setup behaviors from shared email confirmation behavior Nov 7, 2024
@aduth aduth requested a review from a team November 7, 2024 14:39
@aduth aduth force-pushed the aduth-email-confirmation-password-locals branch from 12df960 to ed586a4 Compare November 7, 2024 18:37
aduth added 2 commits November 7, 2024 14:08
changelog: Internal, Performance, Extract shared email confirmation behavior as needed
Probably redundant, but safer to limit impact for initial refactoring
@aduth aduth force-pushed the aduth-email-confirmation-password-locals branch from ed586a4 to 3771936 Compare November 7, 2024 19:10
@aduth aduth merged commit c78aa91 into main Nov 7, 2024
2 checks passed
@aduth aduth deleted the aduth-email-confirmation-password-locals branch November 7, 2024 19:36
@aduth aduth mentioned this pull request Nov 12, 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.

3 participants