feat: 密码不允许使用最近修改的密码功能
This commit is contained in:
@@ -237,6 +237,13 @@ func (s *SysProfileController) PasswordUpdate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查密码是否与历史密码一致
|
||||
err = s.sysUserService.ValidatePasswordNotAllowedHistory(userInfo.UserId, body.NewPassword)
|
||||
if err != nil {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
// 修改新密码
|
||||
userInfo.Password = body.NewPassword
|
||||
userInfo.UpdateBy = userInfo.UserName
|
||||
@@ -296,6 +303,13 @@ func (s *SysProfileController) PasswordForce(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查密码是否与历史密码一致
|
||||
err = s.sysUserService.ValidatePasswordNotAllowedHistory(userInfo.UserId, body.Password)
|
||||
if err != nil {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
userInfo.Password = body.Password
|
||||
userInfo.UpdateBy = reqctx.LoginUserToUserName(c)
|
||||
rows := s.sysUserService.Update(userInfo)
|
||||
|
||||
Reference in New Issue
Block a user