diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-01-05 17:38:05 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-01-05 17:38:05 -0500 |
commit | 482158d2bbc59be80e916bd2197f0fc609d9bc73 (patch) | |
tree | 705b1bd32e97805b972ed25e3d393a47d5ce3d20 | |
parent | 330cbc8f190fc7cbe99186f048bd4656913820be (diff) | |
parent | 6a6558e0eb6cf07f6c6b291418aec7d3022787c7 (diff) | |
download | chat-482158d2bbc59be80e916bd2197f0fc609d9bc73.tar.gz chat-482158d2bbc59be80e916bd2197f0fc609d9bc73.tar.bz2 chat-482158d2bbc59be80e916bd2197f0fc609d9bc73.zip |
Merge pull request #1807 from mattermost/PLT-1572
PLT-1572 Adding more info to the error message
-rw-r--r-- | api/team.go | 3 | ||||
-rw-r--r-- | doc/install/Administration.md | 2 | ||||
-rw-r--r-- | doc/install/Troubleshooting.md | 2 | ||||
-rw-r--r-- | store/sql_user_store.go | 12 |
4 files changed, 12 insertions, 7 deletions
diff --git a/api/team.go b/api/team.go index dd9bd0bac..fbcb301a9 100644 --- a/api/team.go +++ b/api/team.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/gorilla/mux" "github.com/mattermost/platform/model" + "github.com/mattermost/platform/store" "github.com/mattermost/platform/utils" "net/http" "net/url" @@ -480,7 +481,7 @@ func inviteMembers(c *Context, w http.ResponseWriter, r *http.Request) { var invNum int64 = 0 for i, invite := range invites.Invites { - if result := <-Srv.Store.User().GetByEmail(c.Session.TeamId, invite["email"]); result.Err == nil || result.Err.Message != "We couldn't find the existing account" { + if result := <-Srv.Store.User().GetByEmail(c.Session.TeamId, invite["email"]); result.Err == nil || result.Err.Message != store.MISSING_ACCOUNT_ERROR { invNum = int64(i) c.Err = model.NewAppError("invite_members", "This person is already on your team", strconv.FormatInt(invNum, 10)) return diff --git a/doc/install/Administration.md b/doc/install/Administration.md index c51022da1..53f413d04 100644 --- a/doc/install/Administration.md +++ b/doc/install/Administration.md @@ -100,7 +100,7 @@ To upgrade GitLab Mattermost from the 0.7.1-beta release of Mattermost in GitLab - Please check that each step of [the procedure for upgrading Mattermost in GitLab 8.0 to GitLab 8.1 was completed](https://github.com/mattermost/platform/blob/master/doc/install/Upgrade-Guide.md#upgrading-mattermost-in-gitlab-80-to-gitlab-81-with-omnibus). Then check upgrades to successive major versions were completed using the procedure in the [Upgrade Guide](https://github.com/mattermost/platform/blob/master/doc/install/Upgrade-Guide.md#upgrading-mattermost-to-next-major-release). -###### `We couldn't find the existing account` +###### `We couldn't find the existing account ...` - This error appears when a user attempts to sign in using a single-sign-on option with an account that was not created using that single-sign-on option. For example, if a user creates Account A using email sign-up, then attempts to sign-in using GitLab SSO, the error appears since Account A was not created using GitLab SSO. - **Solution:** - If you're switching from email auth to GitLab SSO, and you're getting this issue on an admin account, consider deactivating your email-based account, then creating a new account with System Admin privileges using GitLab SSO. Specifically: diff --git a/doc/install/Troubleshooting.md b/doc/install/Troubleshooting.md index deae7717d..05cac2f48 100644 --- a/doc/install/Troubleshooting.md +++ b/doc/install/Troubleshooting.md @@ -52,7 +52,7 @@ The following is a list of common error messages and solutions: 1. Check that your SSL settings for the SSO provider match the `http://` or `https://` choice selected in `config.json` under `GitLabSettings` 2. Follow steps 1 to 3 of the manual [GitLab SSO configuration procedure](https://github.com/mattermost/platform/blob/master/doc/integrations/Single-Sign-On/Gitlab.md) to confirm your `Secret` and `Id` settings in `config.json` match your GitLab settings, and if they don't, manually update `config.json` to the correct settings and see if this clears the issue. -###### `We couldn't find the existing account` +###### `We couldn't find the existing account ...` - This error appears when a user attempts to sign in using a single-sign-on option with an account that was not created using that single-sign-on option. For example, if a user creates Account A using email sign-up, then attempts to sign-in using GitLab SSO, the error appears since Account A was not created using GitLab SSO. - **Solution:** - If you're switching from email auth to GitLab SSO, and you're getting this issue on an admin account, consider deactivating your email-based account, then creating a new account with System Admin privileges using GitLab SSO. Specifically: diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 88c4f954b..32332ad92 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -10,6 +10,10 @@ import ( "strings" ) +const ( + MISSING_ACCOUNT_ERROR = "We couldn't find an existing account matching your email address for this team. This team may require an invite from the team owner to join." +) + type SqlUserStore struct { *SqlStore } @@ -330,7 +334,7 @@ func (us SqlUserStore) Get(id string) StoreChannel { if obj, err := us.GetReplica().Get(model.User{}, id); err != nil { result.Err = model.NewAppError("SqlUserStore.Get", "We encountered an error finding the account", "user_id="+id+", "+err.Error()) } else if obj == nil { - result.Err = model.NewAppError("SqlUserStore.Get", "We couldn't find the existing account", "user_id="+id) + result.Err = model.NewAppError("SqlUserStore.Get", MISSING_ACCOUNT_ERROR, "user_id="+id) } else { result.Data = obj.(*model.User) } @@ -435,7 +439,7 @@ func (us SqlUserStore) GetByEmail(teamId string, email string) StoreChannel { user := model.User{} if err := us.GetReplica().SelectOne(&user, "SELECT * FROM Users WHERE TeamId = :TeamId AND Email = :Email", map[string]interface{}{"TeamId": teamId, "Email": email}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetByEmail", "We couldn't find the existing account", "teamId="+teamId+", email="+email+", "+err.Error()) + result.Err = model.NewAppError("SqlUserStore.GetByEmail", MISSING_ACCOUNT_ERROR, "teamId="+teamId+", email="+email+", "+err.Error()) } result.Data = &user @@ -457,7 +461,7 @@ func (us SqlUserStore) GetByAuth(teamId string, authData string, authService str user := model.User{} if err := us.GetReplica().SelectOne(&user, "SELECT * FROM Users WHERE TeamId = :TeamId AND AuthData = :AuthData AND AuthService = :AuthService", map[string]interface{}{"TeamId": teamId, "AuthData": authData, "AuthService": authService}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetByAuth", "We couldn't find the existing account", "teamId="+teamId+", authData="+authData+", authService="+authService+", "+err.Error()) + result.Err = model.NewAppError("SqlUserStore.GetByAuth", "We couldn't find an existing account matching your authentication type for this team. This team may require an invite from the team owner to join.", "teamId="+teamId+", authData="+authData+", authService="+authService+", "+err.Error()) } result.Data = &user @@ -479,7 +483,7 @@ func (us SqlUserStore) GetByUsername(teamId string, username string) StoreChanne user := model.User{} if err := us.GetReplica().SelectOne(&user, "SELECT * FROM Users WHERE TeamId = :TeamId AND Username = :Username", map[string]interface{}{"TeamId": teamId, "Username": username}); err != nil { - result.Err = model.NewAppError("SqlUserStore.GetByUsername", "We couldn't find the existing account", "teamId="+teamId+", username="+username+", "+err.Error()) + result.Err = model.NewAppError("SqlUserStore.GetByUsername", "We couldn't find an existing account matching your username for this team. This team may require an invite from the team owner to join.", "teamId="+teamId+", username="+username+", "+err.Error()) } result.Data = &user |