[MM-57942] Fix a panic on password is too long (#27449)
* return error from bcrypt, handle gracefully; remove dead code * linting * linting * i18n * fix test * fill out translations
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5d2bf1ea1c
Коммит
cc5e87ae24
@@ -1445,7 +1445,11 @@ func (a *App) UpdatePassword(rctx request.CTX, user *model.User, newPassword str
|
||||
return model.NewAppError("UpdatePassword", "api.user.update_password.failed.app_error", nil, "", http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
hashedPassword := model.HashPassword(newPassword)
|
||||
hashedPassword, err := model.HashPassword(newPassword)
|
||||
if err != nil {
|
||||
// can't be password length (checked in IsPasswordValid)
|
||||
return model.NewAppError("UpdatePassword", "api.user.update_password.password_hash.app_error", nil, "user_id="+user.Id, http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
if err := a.Srv().Store().User().UpdatePassword(user.Id, hashedPassword); err != nil {
|
||||
return model.NewAppError("UpdatePassword", "api.user.update_password.failed.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
|
||||
Ссылка в новой задаче
Block a user