fix UpdatePwd error
fix UpdatePwd error
This commit is contained in:
1 parent
4925383f5e
commit
a19622f6ac
1 file changed
+6
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user