Skip to content
Snippets Groups Projects

Registration form: Client side validation + better display of server validation errors

Merged Vlad Mikhailov requested to merge raeno/pleroma-fe:better_errors_on_registration into develop

Fixes validation errors during registration, previously errors from BE haven't been parsed and displayed to user as json

Before

Before

After

Screen_Recording_2018-12-05_at_19.32.37

Edited by Vlad Mikhailov

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Maintainer

    Well it's better than what we have right now, just two things:

    1. 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.
    2. I'd group fields so it would say "Password, username, email and confirmation cannot be blank" instead of robot-like sentences.
    3. Probably real solution is to add form validation on FE.
    Edited by HJ
  • Author Contributor

    1 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 Mikhailov
  • Maintainer

    I think ability to bypass it isn't as important in this case tho. Ability to bypass usually referred to when people do validation just client-side.

  • Vlad Mikhailov added 9 commits

    added 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

    Compare with previous version

  • Vlad Mikhailov marked as a Work In Progress

    marked as a Work In Progress

  • Vlad Mikhailov changed the description

    changed the description

  • Vlad Mikhailov added 1 commit

    added 1 commit

    • 2b903f79 - Fix broken ToS link. Fix linter errors

    Compare with previous version

  • Author Contributor

    Client side validation example

    Screenshot_2018-12-05_at_13.48.41

    Things left:

    • I18n for validation messages
    • Validate that password == password_confirmation on client
    • Better styling
    Edited by Vlad Mikhailov
  • Vlad Mikhailov added 2 commits

    added 2 commits

    • f9ff839b - Better styling for client-side validation. Add I18n for validation errors.
    • 91a72d51 - Validate name presence on client-side as well

    Compare with previous version

  • Vlad Mikhailov unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Vlad Mikhailov changed title from WIP: Humanize validation errors returned on registration to Registration form: Client side validation + better display of server validation errors

    changed title from WIP: Humanize validation errors returned on registration to Registration form: Client side validation + better display of server validation errors

  • Vlad Mikhailov changed the description

    changed the description

  • Author Contributor

    @hj added client-side validation with i18n, refactored registration component a bit as well, let me know your thoughs

  • HJ
  • HJ
  • HJ
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading