This commit is contained in:
eson
2023-09-05 16:51:32 +08:00
parent ff8d62399f
commit 1e837a6a4b
2 changed files with 5 additions and 9 deletions

View File

@@ -66,11 +66,11 @@ func (l *UserResetPasswordLogic) UserResetPassword(req *types.RequestUserResetPa
return fmt.Errorf("password had been reset")
}
if *user.PasswordHash == rt.NewPassword {
if *user.PasswordHash == req.NewPassword {
return fmt.Errorf("the password is the same as the old one. It needs to be changed")
}
return tx.Where("id = ?", rt.UserId).Update("PasswordHash", rt.NewPassword).Error
return tx.Where("id = ?", rt.UserId).Update("PasswordHash", req.NewPassword).Error
})
if err != nil {