Merge pull request #1807 from mattermost/PLT-1572
PLT-1572 Adding more info to the error message
Этот коммит содержится в:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Ссылка в новой задаче
Block a user