summaryrefslogtreecommitdiffstats
path: root/app/user.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-02-07 09:35:58 -0800
committerGitHub <noreply@github.com>2017-02-07 09:35:58 -0800
commit9dc76c18231f158ab71dfcfae2f1659a4f2a5396 (patch)
tree57a46a30e52e9f955f4d74d93fc6153640fbecc2 /app/user.go
parentba18374bd1b2644e577247204fad17dd52913b9b (diff)
downloadchat-9dc76c18231f158ab71dfcfae2f1659a4f2a5396.tar.gz
chat-9dc76c18231f158ab71dfcfae2f1659a4f2a5396.tar.bz2
chat-9dc76c18231f158ab71dfcfae2f1659a4f2a5396.zip
Implement PUT /users/{user_id}/password endpoint for APIv4 (#5243)
Diffstat (limited to 'app/user.go')
-rw-r--r--app/user.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/user.go b/app/user.go
index c302db511..2fc308421 100644
--- a/app/user.go
+++ b/app/user.go
@@ -764,22 +764,19 @@ func UpdatePasswordAsUser(userId, currentPassword, newPassword, siteURL string)
}
if user == nil {
- err = model.NewLocAppError("updatePassword", "api.user.update_password.valid_account.app_error", nil, "")
- err.StatusCode = http.StatusBadRequest
+ err = model.NewAppError("updatePassword", "api.user.update_password.valid_account.app_error", nil, "", http.StatusBadRequest)
return err
}
if user.AuthData != nil && *user.AuthData != "" {
- err = model.NewLocAppError("updatePassword", "api.user.update_password.oauth.app_error", nil, "auth_service="+user.AuthService)
- err.StatusCode = http.StatusBadRequest
+ err = model.NewAppError("updatePassword", "api.user.update_password.oauth.app_error", nil, "auth_service="+user.AuthService, http.StatusBadRequest)
return err
}
if err := doubleCheckPassword(user, currentPassword); err != nil {
if err.Id == "api.user.check_user_password.invalid.app_error" {
- err = model.NewLocAppError("updatePassword", "api.user.update_password.incorrect.app_error", nil, "")
+ err = model.NewAppError("updatePassword", "api.user.update_password.incorrect.app_error", nil, "", http.StatusBadRequest)
}
- err.StatusCode = http.StatusForbidden
return err
}