Merge pull request #661 from wxxiong6/patch-1

fix UpdatePwd error
This commit is contained in:
wenjianzhang authored and GitHub committed 2022-07-27 21:20:07 +08:00
commit 214f90b366
1 file changed
+6
+6
View File
@@ -356,6 +356,12 @@ func (e SysUser) UpdatePwd(c *gin.Context) {
if user.GetUserId(c) == 1 && config.ApplicationConfig.Mode == "demo" {
req.NewPassword = "123456"
}
var hash []byte
if hash, err = bcrypt.GenerateFromPassword([]byte(req.NewPassword), bcrypt.DefaultCost); err != nil {
req.NewPassword = string(hash)
}
err = s.UpdatePwd(user.GetUserId(c), req.OldPassword, req.NewPassword, p)
if err != nil {
e.Logger.Error(err)