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,7 +457,16 @@ func (c *ApiController) SetPassword() {
return
}
if oldPassword != "" {
isAdmin := c.IsAdmin()
if isAdmin {
if oldPassword != "" {
msg := object.CheckPassword(targetUser, oldPassword, c.GetAcceptLanguage())
if msg != "" {
c.ResponseError(msg)
return
}
}
} else {
msg := object.CheckPassword(targetUser, oldPassword, c.GetAcceptLanguage())
if msg != "" {
c.ResponseError(msg)