diff options
author | Corey Hulen <corey@hulen.com> | 2015-10-22 21:38:31 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-10-22 21:38:31 -0700 |
commit | 22d7f0f11607e74acdb642eba455a33489c9cd58 (patch) | |
tree | 825e7f87e01c23094d4a82fa518672fade3f647f /api/user.go | |
parent | 640176bd4c9fd13878a3faca12d5ad41512547ba (diff) | |
parent | 4734912c521be4367b1d8ca255cc76c0095839b4 (diff) | |
download | chat-22d7f0f11607e74acdb642eba455a33489c9cd58.tar.gz chat-22d7f0f11607e74acdb642eba455a33489c9cd58.tar.bz2 chat-22d7f0f11607e74acdb642eba455a33489c9cd58.zip |
Merge pull request #1143 from mattermost/plt-803
PLT-803 Prevent users from resetting their password when the user is using SSO
Diffstat (limited to 'api/user.go')
-rw-r--r-- | api/user.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/api/user.go b/api/user.go index aec975524..3071e1b26 100644 --- a/api/user.go +++ b/api/user.go @@ -1221,6 +1221,11 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) { user = result.Data.(*model.User) } + if len(user.AuthData) != 0 { + c.Err = model.NewAppError("sendPasswordReset", "Cannot reset password for SSO accounts", "userId="+user.Id+", teamId="+team.Id) + return + } + newProps := make(map[string]string) newProps["user_id"] = user.Id newProps["time"] = fmt.Sprintf("%v", model.GetMillis()) @@ -1305,6 +1310,11 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) { user = result.Data.(*model.User) } + if len(user.AuthData) != 0 { + c.Err = model.NewAppError("resetPassword", "Cannot reset password for SSO accounts", "userId="+user.Id+", teamId="+team.Id) + return + } + if user.TeamId != team.Id { c.Err = model.NewAppError("resetPassword", "Trying to reset password for user on wrong team.", "userId="+user.Id+", teamId="+team.Id) c.Err.StatusCode = http.StatusForbidden |