summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-06-15 08:02:07 -0400
committerGitHub <noreply@github.com>2016-06-15 08:02:07 -0400
commitf6fc4bdbdb62050a04e4c592af700312a3a56dbf (patch)
tree84ecc1959512f1d51affa9948998b85499badc7b /store
parent0f7a8f0fb52f4376a42391812a20e622e82fef4e (diff)
downloadchat-f6fc4bdbdb62050a04e4c592af700312a3a56dbf.tar.gz
chat-f6fc4bdbdb62050a04e4c592af700312a3a56dbf.tar.bz2
chat-f6fc4bdbdb62050a04e4c592af700312a3a56dbf.zip
Update error message when trying to switch account with a duplicate email (#3332)
Diffstat (limited to 'store')
-rw-r--r--store/sql_user_store.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go
index 6313a91e2..635e53be6 100644
--- a/store/sql_user_store.go
+++ b/store/sql_user_store.go
@@ -348,7 +348,11 @@ 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 {
- result.Err = model.NewLocAppError("SqlUserStore.UpdateAuthData", "store.sql_user.update_auth_data.app_error", nil, "id="+userId+", "+err.Error())
+ if IsUniqueConstraintError(err.Error(), []string{"Email", "users_email_key", "idx_users_email_unique"}) {
+ 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())
+ }
} else {
result.Data = userId
}