summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-05-05 16:36:42 -0400
committerChristopher Speller <crspeller@gmail.com>2016-05-05 16:36:42 -0400
commitf2e788f4b12517759e016a9f48633597bed82e8f (patch)
treeb1881587688460d4f122f012e4f6e0356857f902 /api
parentd2ddf40f56191c1770c3ca93d747a7f1b749f26c (diff)
downloadchat-f2e788f4b12517759e016a9f48633597bed82e8f.tar.gz
chat-f2e788f4b12517759e016a9f48633597bed82e8f.tar.bz2
chat-f2e788f4b12517759e016a9f48633597bed82e8f.zip
Allow system admins to switch user accounts to email/password (#2893)
Diffstat (limited to 'api')
-rw-r--r--api/admin_test.go4
-rw-r--r--api/user.go2
2 files changed, 1 insertions, 5 deletions
diff --git a/api/admin_test.go b/api/admin_test.go
index 1d8f6bb6b..933c3d59c 100644
--- a/api/admin_test.go
+++ b/api/admin_test.go
@@ -462,10 +462,6 @@ func TestAdminResetPassword(t *testing.T) {
LinkUserToTeam(user2, team)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
- if _, err := Client.AdminResetPassword(user2.Id, "newpwd"); err == nil {
- t.Fatal("should have errored - SSO user can't reset password")
- }
-
if _, err := Client.AdminResetPassword(user.Id, "newpwd"); err != nil {
t.Fatal(err)
}
diff --git a/api/user.go b/api/user.go
index f7d3eb1d3..1331bd3da 100644
--- a/api/user.go
+++ b/api/user.go
@@ -1702,7 +1702,7 @@ func ResetPassword(c *Context, userId, newPassword string) *model.AppError {
user = result.Data.(*model.User)
}
- if len(user.AuthData) != 0 {
+ if len(user.AuthData) != 0 && !c.IsSystemAdmin() {
return model.NewLocAppError("ResetPassword", "api.user.reset_password.sso.app_error", nil, "userId="+user.Id)
}