Return the error message when changing password with wrong old password (#6466)

Return a meaningful error message when changing password but the a wrong old password is provided to render on UI

Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
Wenkai Yin 2018-12-06 13:29:30 +08:00 committed by Yan
parent eeb6d4a9b9
commit 746d58ceb4

View File

@ -304,7 +304,8 @@ func (ua *UserAPI) ChangePassword() {
}
if changePwdOfOwn {
if user.Password != utils.Encrypt(req.OldPassword, user.Salt) {
ua.HandleForbidden("incorrect old_password")
log.Info("incorrect old_password")
ua.RenderError(http.StatusForbidden, "incorrect old_password")
return
}
}