jimguys/poemlab — pull request #33 by drueck (2013-09-28 09:23:49+00:00)
Title: Add Poet Validation

Client Side Validations That:

- Passwords are at least 6 characters long
- Confirmation matches password

I'm doing this on the client because once the password is hashed you don't know whether it was present in the first place or how long it was. There is a little bit of duplication of the knowledge of how errors are added to the DOM, but it's about as basic as you can get, so I'm not too worried.

Server Side Validations:

- Username, email and password are present
- Username and email are unique
- Email looks like an email (super simple regex, we should probably do email confirmations eventually)
- Password is hashed as expected

I'm just rendering all of the errors that are returned in the register template, and I made them red so they stand out.

Currently I am not re-filling in the form with the data they submitted--just rendering the empty form with the error message(s) listed above. We could add populate the fields with the data they already submitted if we think it's valuable. Actually, just the username and email since the clear text passwords aren't saved.