mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
merged with new team domain changes and added signup/login links for gitlab
This commit is contained in:
12
api/user.go
12
api/user.go
@@ -1224,17 +1224,17 @@ func getStatuses(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func GetAuthorizationCode(c *Context, w http.ResponseWriter, r *http.Request, service, redirectUri string) {
|
||||
params := mux.Vars(r)
|
||||
teamName := params["team"]
|
||||
|
||||
teamId := r.FormValue("id")
|
||||
|
||||
if len(teamId) != 26 {
|
||||
c.Err = model.NewAppError("GetAuthorizationCode", "Invalid team id", "team_id="+teamId)
|
||||
if len(teamName) == 0 {
|
||||
c.Err = model.NewAppError("GetAuthorizationCode", "Invalid team name", "team_name="+teamName)
|
||||
c.Err.StatusCode = http.StatusBadRequest
|
||||
return
|
||||
}
|
||||
|
||||
// Make sure team exists
|
||||
if result := <-Srv.Store.Team().Get(teamId); result.Err != nil {
|
||||
if result := <-Srv.Store.Team().GetByName(teamName); result.Err != nil {
|
||||
c.Err = result.Err
|
||||
return
|
||||
}
|
||||
@@ -1249,7 +1249,7 @@ func GetAuthorizationCode(c *Context, w http.ResponseWriter, r *http.Request, se
|
||||
endpoint := utils.Cfg.SSOSettings[service].AuthEndpoint
|
||||
state := model.HashPassword(clientId)
|
||||
|
||||
authUrl := endpoint + "?response_type=code&client_id=" + clientId + "&redirect_uri=" + url.QueryEscape(redirectUri+"?id="+teamId) + "&state=" + url.QueryEscape(state)
|
||||
authUrl := endpoint + "?response_type=code&client_id=" + clientId + "&redirect_uri=" + url.QueryEscape(redirectUri+"?team="+teamName) + "&state=" + url.QueryEscape(state)
|
||||
http.Redirect(w, r, authUrl, http.StatusFound)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user