diff --git a/api/admin_test.go b/api/admin_test.go index 1d8f6bb6b9..933c3d59c3 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 f7d3eb1d3e..1331bd3da1 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) } diff --git a/webapp/components/admin_console/reset_password_modal.jsx b/webapp/components/admin_console/reset_password_modal.jsx index 5133f3f286..c383a4fb84 100644 --- a/webapp/components/admin_console/reset_password_modal.jsx +++ b/webapp/components/admin_console/reset_password_modal.jsx @@ -58,7 +58,8 @@ class ResetPasswordModal extends React.Component { } render() { - if (this.props.user == null) { + const user = this.props.user; + if (user == null) { return
; } @@ -70,6 +71,23 @@ class ResetPasswordModal extends React.Component { serverError ={this.state.serverError}