mirror of
https://github.com/cuigh/swirl
synced 2024-12-29 07:12:11 +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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !password.Validate(user.Password, oldPwd, user.Salt) {
|
if !password.Validate(oldPwd, user.Password, user.Salt) {
|
||||||
err = errors.New("Current password is incorrect")
|
err = errors.New("Current password is incorrect")
|
||||||
return
|
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 {
|
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 ErrIncorrectAuth
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user