Strip leading and trailing whitespace from user's name
requested to merge 342133-leading-trailing-whitespace-in-the-name-field-when-creating-a-user-are-persisted into master
What does this MR do and why?
Related to #342133 (closed)
Previously it was possible for an Admin to create a user with leading/trailing whitespace in the name. If you tried to delete the user it was required to enter the name with whitespace in the confirmation input. To fix this bug, this MR does the following:
- Uses the
strip_attributes!
concern to strip leading and trailing whitespace from the name of newly created users. - Strips whitespace from existing user's names in the app/assets/javascripts/admin/users/components/modals/delete_user_modal.vue component.
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
- Sign in as an Admin
- Navigate to
/admin/users/new
and create a user with leading and/or trailing whitespace in the name - Find the user in
/admin/users
and click theDelete user
button in the dropdown. - The username should be displayed without the whitespace.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Hegman