fix: comparing hashed password with plain text password during password grant (#627)

* fix: use object.CheckPassword for password grant

* Apply suggestions from code review

fix: remove log per change request
This commit is contained in:
Minh Ha
2022-03-30 05:37:38 +13:00
committed by GitHub
parent e3f5bf93b2
commit 24459d852e

View File

@ -522,7 +522,8 @@ func GetPasswordToken(application *Application, username string, password string
if user == nil { if user == nil {
return nil, errors.New("error: the user does not exist") return nil, errors.New("error: the user does not exist")
} }
if user.Password != password { msg := CheckPassword(user, password)
if msg != "" {
return nil, errors.New("error: invalid username or password") return nil, errors.New("error: invalid username or password")
} }
if user.IsForbidden { if user.IsForbidden {