diff options
author | Asaad Mahmood <Unknowngi@live.com> | 2015-10-23 10:53:57 +0500 |
---|---|---|
committer | Asaad Mahmood <Unknowngi@live.com> | 2015-10-23 10:53:57 +0500 |
commit | cc904a7ec73a44a337908c685bfc311bdbe1ff85 (patch) | |
tree | 6fb865bb734cad0389490e4add11f2e308fe473c /store/sql_user_store.go | |
parent | 79ce0dd914713aac9d2f1332202a48e7e0d338a3 (diff) | |
parent | 02a6f6b2cd4c0a6bf32b23961557c385039ae2f2 (diff) | |
download | chat-cc904a7ec73a44a337908c685bfc311bdbe1ff85.tar.gz chat-cc904a7ec73a44a337908c685bfc311bdbe1ff85.tar.bz2 chat-cc904a7ec73a44a337908c685bfc311bdbe1ff85.zip |
Merge branch 'master' of https://github.com/mattermost/platform into ui-improvements
Diffstat (limited to 'store/sql_user_store.go')
-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 |