[MM-64896][MM-64898] Pass inviteid/tokenid to relay state/props for external auth when auto-joining a team (#33545) (#33666)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ed9e2dbbce
Коммит
2d5cdc6e21
@@ -306,7 +306,7 @@ func completeOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
uri := c.GetSiteURLHeader() + "/signup/" + service + "/complete"
|
||||
|
||||
body, teamId, props, tokenUser, err := c.App.AuthorizeOAuthUser(c.AppContext, w, r, service, code, state, uri)
|
||||
body, props, tokenUser, err := c.App.AuthorizeOAuthUser(c.AppContext, w, r, service, code, state, uri)
|
||||
|
||||
action := ""
|
||||
hasRedirectURL := false
|
||||
@@ -337,7 +337,7 @@ func completeOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
user, err := c.App.CompleteOAuth(c.AppContext, service, body, teamId, props, tokenUser)
|
||||
user, err := c.App.CompleteOAuth(c.AppContext, service, body, props, tokenUser)
|
||||
if err != nil {
|
||||
err.Translate(c.AppContext.T)
|
||||
c.LogErrorByCode(err)
|
||||
@@ -449,13 +449,11 @@ func loginWithOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
auditRec.AddMeta("service", c.Params.Service)
|
||||
defer c.LogAuditRec(auditRec)
|
||||
|
||||
teamId, err := c.App.GetTeamIdFromQuery(c.AppContext, r.URL.Query())
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
// Get invite token or ID instead of team_id
|
||||
tokenID := r.URL.Query().Get("t")
|
||||
inviteId := r.URL.Query().Get("id")
|
||||
|
||||
authURL, err := c.App.GetOAuthLoginEndpoint(c.AppContext, w, r, c.Params.Service, teamId, model.OAuthActionLogin, redirectURL, loginHint, false, desktopToken)
|
||||
authURL, err := c.App.GetOAuthLoginEndpoint(c.AppContext, w, r, c.Params.Service, model.OAuthActionLogin, redirectURL, loginHint, false, desktopToken, tokenID, inviteId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -485,13 +483,11 @@ func mobileLoginWithOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
auditRec.AddMeta("service", c.Params.Service)
|
||||
defer c.LogAuditRec(auditRec)
|
||||
|
||||
teamId, err := c.App.GetTeamIdFromQuery(c.AppContext, r.URL.Query())
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
// Get invite token or ID instead of team_id
|
||||
tokenID := r.URL.Query().Get("t")
|
||||
inviteId := r.URL.Query().Get("id")
|
||||
|
||||
authURL, err := c.App.GetOAuthLoginEndpoint(c.AppContext, w, r, c.Params.Service, teamId, model.OAuthActionMobile, redirectURL, "", true, "")
|
||||
authURL, err := c.App.GetOAuthLoginEndpoint(c.AppContext, w, r, c.Params.Service, model.OAuthActionMobile, redirectURL, "", true, "", tokenID, inviteId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -520,15 +516,13 @@ func signupWithOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
auditRec.AddMeta("service", c.Params.Service)
|
||||
defer c.LogAuditRec(auditRec)
|
||||
|
||||
teamId, err := c.App.GetTeamIdFromQuery(c.AppContext, r.URL.Query())
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
// Get invite token or ID instead of team_id
|
||||
tokenID := r.URL.Query().Get("t")
|
||||
inviteId := r.URL.Query().Get("id")
|
||||
|
||||
desktopToken := r.URL.Query().Get("desktop_token")
|
||||
|
||||
authURL, err := c.App.GetOAuthSignupEndpoint(c.AppContext, w, r, c.Params.Service, teamId, desktopToken)
|
||||
authURL, err := c.App.GetOAuthSignupEndpoint(c.AppContext, w, r, c.Params.Service, desktopToken, tokenID, inviteId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
Ссылка в новой задаче
Block a user