Validate user password

Fixes #29.
This commit is contained in:
Matthew Dillon 2015-11-13 13:43:09 -07:00
parent a482a083bf
commit 5e5121fc65
2 changed files with 18 additions and 6 deletions

View file

@ -181,6 +181,13 @@ func UpdateUserPassword(claims *types.Claims, password string) error {
return err
}
// Temporarily set PW as plaintext, for validation purposes
user.Password = password
if err := user.validate(); err != nil {
return err
}
hash, err := bcrypt.GenerateFromPassword([]byte(password), 12)
if err != nil {
return err