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 /store | |
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 'store')
-rw-r--r-- | store/sql_user_store.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index a2b317afa..5fab38ace 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -125,6 +125,7 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha oldUser := oldUserResult.(*model.User) user.CreateAt = oldUser.CreateAt user.AuthData = oldUser.AuthData + user.AuthService = oldUser.AuthService user.Password = oldUser.Password user.LastPasswordUpdate = oldUser.LastPasswordUpdate user.LastPictureUpdate = oldUser.LastPictureUpdate @@ -265,7 +266,7 @@ func (us SqlUserStore) UpdatePassword(userId, hashedPassword string) StoreChanne updateAt := model.GetMillis() - if _, err := us.GetMaster().Exec("UPDATE Users SET Password = :Password, LastPasswordUpdate = :LastPasswordUpdate, UpdateAt = :UpdateAt, FailedAttempts = 0 WHERE Id = :UserId", map[string]interface{}{"Password": hashedPassword, "LastPasswordUpdate": updateAt, "UpdateAt": updateAt, "UserId": userId}); err != nil { + if _, err := us.GetMaster().Exec("UPDATE Users SET Password = :Password, LastPasswordUpdate = :LastPasswordUpdate, UpdateAt = :UpdateAt, FailedAttempts = 0 WHERE Id = :UserId AND AuthData = ''", map[string]interface{}{"Password": hashedPassword, "LastPasswordUpdate": updateAt, "UpdateAt": updateAt, "UserId": userId}); err != nil { result.Err = model.NewAppError("SqlUserStore.UpdatePassword", "We couldn't update the user password", "id="+userId+", "+err.Error()) } else { result.Data = userId |