bradtraversy / node_passport_login

Node.js login, registration and access control using Express and Passport
1.74k stars 1.3k forks source link

issue in validation #11

Closed harshittpandey closed 5 years ago

harshittpandey commented 7 years ago

hey, please correct me if i am wrong, if you don't enter password2 then it is showing password doesnt match instead of passsword2 field empty. and, if you don't enter email then it is showing email is not valid along with email is empty.

Saspect-IO commented 7 years ago

If you look at the validation section of the code you will see that one validator clause is set for password2. So whether it is empty or incorrect it will not be equal to password 1.

With regards to email two validator clauses are set on it so it will trigger both if it is empty because an empty field is both invalid and empty.
And will trigger one clause if you enter an invalid email.

Try entering an invalid email like missing the @ symbol and see.