Refactor of the password and email validation.