From 16bc28897de7549aba875f72f746ba5f2100507e Mon Sep 17 00:00:00 2001 From: cuigh Date: Mon, 27 Nov 2017 17:20:04 +0800 Subject: [PATCH] Fix password validation --- biz/user.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/biz/user.go b/biz/user.go index 9b8f1c9..4394075 100644 --- a/biz/user.go +++ b/biz/user.go @@ -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