Skip to content

Add name validation for password field during registration

What does this MR do and why?

We should tell the user about any password conditions at the start, which will ultimately help the user to create a more secure account.

Add name validation for password field during registration to replace "Minimum length is 8 characters":

• Cannot include your name, username, or email

Based on the technical details implement name / username exclusion by analogy with common phrases.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before After
Screenshot_2024-11-26_at_17.41.23 Screenshot_2024-11-26_at_17.39.24
Screenshot_2024-11-26_at_17.41.13 Screenshot_2024-11-26_at_17.39.34
Screenshot_2024-11-26_at_17.40.58 Screenshot_2024-11-26_at_17.40.08

How to set up and validate locally

bin/rails c

Feature.enable(:display_password_requirements)
  • Setup gdk to simulate SaaS - https://docs.gitlab.com/ee/development/ee_features.html#simulate-a-saas-instance and restart GDK.
  • Make sure you have License locally (can be faked here by returning true).
  • Sign out. Visit /users/sign_up.
  • Fill the first name with tttt
  • Fill the the rest of the form with valid data.
  • Fill the password with tttttttt.
  • Make sure the cannot include your name, username, or email text stays grey.
  • Replace password with rrrrrrrr. Make sure the text is green.
  • Add tttt to the password. Make sure the text becomes grey.
  • Clear the password field. Click Register.
  • Make sure the cannot include your name, username, or email text becomes red.
  • Enter rrrrrrrr as password. Make sure the text is green.
  • Submit the form.

Related to #461831 (closed)

Edited by Serhii Yarynovskyi

Merge request reports

Loading