Registration form: Client side validation + better display of server validation errors
Fixes validation errors during registration, previously errors from BE haven't been parsed and displayed to user as json
Before
After
Edited by Vlad Mikhailov
Merge request reports
Activity
added 1 commit
- 70c4faa0 - Humanize validation errors returned on registration
- Resolved by Vlad Mikhailov
Well it's better than what we have right now, just two things:
- I'd do string comparison, just in case BE sends something more technical that's better to rephrase. Also that would allow i18n on FE.
- I'd group fields so it would say "Password, username, email and confirmation cannot be blank" instead of robot-like sentences.
- Probably real solution is to add form validation on FE.
Edited by HJ1 and 2 are good points, I'll change the code to group messages by the validation rule, not by the field.
About 3, don't think we can replace BE validation with FE only. Client-side validation is a nice thing to have since it gives instant feedback to our user. It's not reliable though and always can be bypassed so we would still need some way to show errors from BE validation.
Edited by Vlad Mikhailovadded 9 commits
-
70c4faa0...3fa9b391 - 6 commits from branch
pleroma:develop
- 822559af - Humanize validation errors returned on registration
- 02e000b5 - Use Array.reduce instead of lodash.reduce
- 00293137 - Add client validation for registration form
Toggle commit list-
70c4faa0...3fa9b391 - 6 commits from branch
Client side validation example
Things left:
- I18n for validation messages
- Validate that password == password_confirmation on client
- Better styling
Edited by Vlad Mikhailov@hj added client-side validation with i18n, refactored registration component a bit as well, let me know your thoughs
- Resolved by Vlad Mikhailov
- Resolved by HJ
- Resolved by HJ
Please register or sign in to reply