document bcrypt support

This commit is contained in:
Nicola Murino
2019-07-29 09:20:33 +02:00
parent 2456d5c3bf
commit 7dd03ee24e
2 changed files with 4 additions and 7 deletions

View File

@@ -46,15 +46,12 @@ func sqlCommonValidateUserAndPass(username string, password string) (User, error
logger.Warn(logSender, "error comparing password with argon hash: %v", err)
return user, err
}
} else if strings.HasPrefix(user.Password, bcryptPwdPrefix){
err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(password))
if err != nil {
} else if strings.HasPrefix(user.Password, bcryptPwdPrefix) {
if err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(password)); err != nil {
logger.Warn(logSender, "error comparing password with bcrypt hash: %v", err)
return user, err
}else{
match = true
}
match = true
} else {
// clear text password match
match = (user.Password == password)