diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-09-02 05:59:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-02 05:59:01 +0800 |
commit | 94c9138c1986cb35b930f6e3e98993b851f69ef9 (patch) | |
tree | 143243f55f17d18fdbbcd22afa20f1826093cc28 /store | |
parent | 196cdbe9d19a754ea0ef05785c1ea8c37cdf5a89 (diff) | |
download | chat-94c9138c1986cb35b930f6e3e98993b851f69ef9.tar.gz chat-94c9138c1986cb35b930f6e3e98993b851f69ef9.tar.bz2 chat-94c9138c1986cb35b930f6e3e98993b851f69ef9.zip |
[PLT-7385] Add AuthData to IsUniqueConstraintError to indicate duplicated email entry (#7197)
* add AuthData to IsUniqueConstraintError to indicate duplicated email entry
* add unique constraint for postgres
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_user_store.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 23c852d89..f37a4765e 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -321,7 +321,7 @@ func (us SqlUserStore) UpdateAuthData(userId string, service string, authData *s query += " WHERE Id = :UserId" if _, err := us.GetMaster().Exec(query, map[string]interface{}{"LastPasswordUpdate": updateAt, "UpdateAt": updateAt, "UserId": userId, "AuthService": service, "AuthData": authData, "Email": email}); err != nil { - if IsUniqueConstraintError(err.Error(), []string{"Email", "users_email_key", "idx_users_email_unique"}) { + if IsUniqueConstraintError(err.Error(), []string{"Email", "users_email_key", "idx_users_email_unique", "AuthData", "users_authdata_key"}) { result.Err = model.NewLocAppError("SqlUserStore.UpdateAuthData", "store.sql_user.update_auth_data.email_exists.app_error", map[string]interface{}{"Service": service, "Email": email}, "user_id="+userId+", "+err.Error()) } else { result.Err = model.NewLocAppError("SqlUserStore.UpdateAuthData", "store.sql_user.update_auth_data.app_error", nil, "id="+userId+", "+err.Error()) |