diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-02-07 10:46:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-07 10:46:40 -0800 |
commit | eb767d2c1cb65724f25479144d68a9d102d32dfa (patch) | |
tree | fe5e9efd2a1b039c0dda505a50684f7294d4fcc4 /app/user.go | |
parent | f7d5a770601fa223a27bc93aee348b6527d5a7a4 (diff) | |
download | chat-eb767d2c1cb65724f25479144d68a9d102d32dfa.tar.gz chat-eb767d2c1cb65724f25479144d68a9d102d32dfa.tar.bz2 chat-eb767d2c1cb65724f25479144d68a9d102d32dfa.zip |
Implement password reset endpoints for APIv4 (#5256)
Diffstat (limited to 'app/user.go')
-rw-r--r-- | app/user.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/user.go b/app/user.go index 2fc308421..badcc1676 100644 --- a/app/user.go +++ b/app/user.go @@ -966,7 +966,7 @@ func SendPasswordReset(email string, siteURL string) (bool, *model.AppError) { } if user.AuthData != nil && len(*user.AuthData) != 0 { - return false, model.NewLocAppError("SendPasswordReset", "api.user.send_password_reset.sso.app_error", nil, "userId="+user.Id) + return false, model.NewAppError("SendPasswordReset", "api.user.send_password_reset.sso.app_error", nil, "userId="+user.Id, http.StatusBadRequest) } var recovery *model.PasswordRecovery @@ -1001,7 +1001,7 @@ func ResetPasswordFromCode(code, newPassword, siteURL string) *model.AppError { return err } else { if model.GetMillis()-recovery.CreateAt >= model.PASSWORD_RECOVER_EXPIRY_TIME { - return model.NewLocAppError("resetPassword", "api.user.reset_password.link_expired.app_error", nil, "") + return model.NewAppError("resetPassword", "api.user.reset_password.link_expired.app_error", nil, "", http.StatusBadRequest) } } @@ -1011,7 +1011,7 @@ func ResetPasswordFromCode(code, newPassword, siteURL string) *model.AppError { } if user.IsSSOUser() { - return model.NewLocAppError("ResetPasswordFromCode", "api.user.reset_password.sso.app_error", nil, "userId="+user.Id) + return model.NewAppError("ResetPasswordFromCode", "api.user.reset_password.sso.app_error", nil, "userId="+user.Id, http.StatusBadRequest) } T := utils.GetUserTranslations(user.Locale) @@ -1040,7 +1040,7 @@ func CreatePasswordRecovery(userId string) (*model.PasswordRecovery, *model.AppE func GetPasswordRecovery(code string) (*model.PasswordRecovery, *model.AppError) { if result := <-Srv.Store.PasswordRecovery().GetByCode(code); result.Err != nil { - return nil, model.NewLocAppError("GetPasswordRecovery", "api.user.reset_password.invalid_link.app_error", nil, result.Err.Error()) + return nil, model.NewAppError("GetPasswordRecovery", "api.user.reset_password.invalid_link.app_error", nil, result.Err.Error(), http.StatusBadRequest) } else { return result.Data.(*model.PasswordRecovery), nil } |