[MM-13839] Check for password when updating the eMail (#10207)
* Check for password when updating the eMail * Require password for email change * Enhance unit testing * Restructure error handling for update email path * govet
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
9a3dc21adc
Коммит
85c60f1402
@@ -57,7 +57,7 @@ func (a *App) CheckPasswordAndAllCriteria(user *model.User, password string, mfa
|
||||
}
|
||||
|
||||
// This to be used for places we check the users password when they are already logged in
|
||||
func (a *App) doubleCheckPassword(user *model.User, password string) *model.AppError {
|
||||
func (a *App) DoubleCheckPassword(user *model.User, password string) *model.AppError {
|
||||
if err := checkUserLoginAttempts(user, *a.Config().ServiceSettings.MaximumLoginAttempts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -854,7 +854,7 @@ func (a *App) UpdatePasswordAsUser(userId, currentPassword, newPassword string)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := a.doubleCheckPassword(user, currentPassword); err != nil {
|
||||
if err := a.DoubleCheckPassword(user, currentPassword); err != nil {
|
||||
if err.Id == "api.user.check_user_password.invalid.app_error" {
|
||||
err = model.NewAppError("updatePassword", "api.user.update_password.incorrect.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user