Skip to content

Remember the email after registration errors

Nick Malcolm requested to merge 384537-remember-email into master

What does this MR do and why?

When registering an account and encountering an error, the email field would not be remembered / be reset to an empty string. This MR fixes this UX bug.

The root cause was that the form assumed that if an email ever needed to be populated in the form, that it'd come from a value @invite_email which is only used during Invitation flows.

The goal of this MR is to fix the registration form, while maintaining existing Invitation behaviour.

Closes Email field is reset on registration error (#384537 - closed)

Screenshots or screen recordings

Before

Dec-05-2022_09-42-41

After

Dec-05-2022_16-09-47

How to set up and validate locally

  1. Pull the branch
  2. Register for an account, but use a weak password (e.g. password123)
  3. Notice that the email is remembered

Also worth validating, but is backed by existing specs:

  1. Invite a user to a Project or Group
  2. In another tab / after signing out, visit the Invitation page
  3. Note that the invite_email is still correctly populated both on that page and if you click "Already have a login and password? Sign in"

To get to this page more easily, you can do the following in a local rails console:

invite = Member.last
raw, enc = Devise.token_generator.generate(invite.class, :invite_token)
=> ["INVITE_TOKEN_RAW", "INVITE_TOKEN_ENC"]
invite.update(invite_token: enc)

Then visit http://gdk.test:3000/-/invites/INVITE_TOKEN_RAW?invite_type=initial_email

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #384537 (closed)

Edited by Nick Malcolm

Merge request reports