[MM-25780] Fix incorrect session length when logging in through mobile using SSO (#14874)
* Pass device ID * dont use device id as way of detecting * fix spelling mistake * update layers * fix test * fix linting * save schema * put columns in correct place * fix linting * update * upgrade go change * use props * fix stuff * update session tests * address PR comments * address PR comments
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
df943fbf91
Коммит
4c50c7c59b
11
web/oauth.go
11
web/oauth.go
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/app"
|
||||
@@ -301,7 +302,11 @@ func completeOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
} else if action == model.OAUTH_ACTION_SSO_TO_EMAIL {
|
||||
redirectUrl = app.GetProtocol(r) + "://" + r.Host + "/claim?email=" + url.QueryEscape(props["email"])
|
||||
} else {
|
||||
err = c.App.DoLogin(w, r, user, "")
|
||||
isMobile, parseErr := strconv.ParseBool(props[model.USER_AUTH_SERVICE_IS_MOBILE])
|
||||
if parseErr != nil {
|
||||
mlog.Error("Error parsing boolean property from props", mlog.Err(parseErr))
|
||||
}
|
||||
err = c.App.DoLogin(w, r, user, "", isMobile, true, false)
|
||||
if err != nil {
|
||||
err.Translate(c.App.T)
|
||||
c.Err = err
|
||||
@@ -343,7 +348,7 @@ func loginWithOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
authUrl, err := c.App.GetOAuthLoginEndpoint(w, r, c.Params.Service, teamId, model.OAUTH_ACTION_LOGIN, redirectTo, loginHint)
|
||||
authUrl, err := c.App.GetOAuthLoginEndpoint(w, r, c.Params.Service, teamId, model.OAUTH_ACTION_LOGIN, redirectTo, loginHint, false)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -364,7 +369,7 @@ func mobileLoginWithOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
authUrl, err := c.App.GetOAuthLoginEndpoint(w, r, c.Params.Service, teamId, model.OAUTH_ACTION_MOBILE, "", "")
|
||||
authUrl, err := c.App.GetOAuthLoginEndpoint(w, r, c.Params.Service, teamId, model.OAUTH_ACTION_MOBILE, "", "", true)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
Ссылка в новой задаче
Block a user