Check old password for normal user in SetPassword()

This commit is contained in:
Yang Luo 2023-09-15 10:21:02 +08:00
parent 616629ef99
commit 1276da4daa

View File

@ -457,6 +457,8 @@ func (c *ApiController) SetPassword() {
return
}
isAdmin := c.IsAdmin()
if isAdmin {
if oldPassword != "" {
msg := object.CheckPassword(targetUser, oldPassword, c.GetAcceptLanguage())
if msg != "" {
@ -464,6 +466,13 @@ func (c *ApiController) SetPassword() {
return
}
}
} else {
msg := object.CheckPassword(targetUser, oldPassword, c.GetAcceptLanguage())
if msg != "" {
c.ResponseError(msg)
return
}
}
msg := object.CheckPasswordComplexity(targetUser, newPassword)
if msg != "" {