|
|
@@ -247,10 +247,14 @@ func (ct *User) ChangeCurPwd(c *gin.Context) {
|
|
247
|
247
|
return
|
|
248
|
248
|
}
|
|
249
|
249
|
u := service.AllService.UserService.CurUser(c)
|
|
250
|
|
- oldPwd := service.AllService.UserService.EncryptPassword(f.OldPassword)
|
|
251
|
|
- if u.Password != oldPwd {
|
|
252
|
|
- response.Fail(c, 101, response.TranslateMsg(c, "OldPasswordError"))
|
|
253
|
|
- return
|
|
|
250
|
+ // If the password is not empty, the old password is verified
|
|
|
251
|
+ // otherwise, the old password is not verified
|
|
|
252
|
+ if !service.AllService.UserService.IsPasswordEmptyByUser(u) {
|
|
|
253
|
+ oldPwd := service.AllService.UserService.EncryptPassword(f.OldPassword)
|
|
|
254
|
+ if u.Password != oldPwd {
|
|
|
255
|
+ response.Fail(c, 101, response.TranslateMsg(c, "OldPasswordError"))
|
|
|
256
|
+ return
|
|
|
257
|
+ }
|
|
254
|
258
|
}
|
|
255
|
259
|
err := service.AllService.UserService.UpdatePassword(u, f.NewPassword)
|
|
256
|
260
|
if err != nil {
|