fix UpdatePwd error

fix UpdatePwd error
This commit is contained in:
wxxiong6 authored and GitHub committed 2022-06-13 23:36:12 +08:00
1 parent 4925383f5e
commit a19622f6ac
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)