mirror of
https://github.com/cuigh/swirl
synced 2024-12-28 14:51:57 +00:00
Fix password validation
This commit is contained in:
parent
db278dbe18
commit
16bc28897d
@ -107,7 +107,7 @@ func (b *userBiz) UpdatePassword(id, oldPwd, newPwd string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
if !password.Validate(user.Password, oldPwd, user.Salt) {
|
||||
if !password.Validate(oldPwd, user.Password, user.Salt) {
|
||||
err = errors.New("Current password is incorrect")
|
||||
return
|
||||
}
|
||||
@ -189,7 +189,7 @@ func (b *userBiz) Login(name, pwd string) (token string, err error) {
|
||||
}
|
||||
|
||||
func (b *userBiz) loginInternal(user *model.User, pwd string) error {
|
||||
if !password.Validate(user.Password, pwd, user.Salt) {
|
||||
if !password.Validate(pwd, user.Password, user.Salt) {
|
||||
return ErrIncorrectAuth
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user