summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-07-22 10:12:28 -0400
committerJoramWilander <jwawilander@gmail.com>2015-07-22 10:12:28 -0400
commit62c0603c50c7cc85003fb03ed55d1a585c32dc34 (patch)
treec5f230f7ba2d61da9a50eeafe88a7b5530025f8d /api
parent03528b9619747b8bd184b852497dcf14ee1e0081 (diff)
downloadchat-62c0603c50c7cc85003fb03ed55d1a585c32dc34.tar.gz
chat-62c0603c50c7cc85003fb03ed55d1a585c32dc34.tar.bz2
chat-62c0603c50c7cc85003fb03ed55d1a585c32dc34.zip
merged with new team domain changes and added signup/login links for gitlab
Diffstat (limited to 'api')
-rw-r--r--api/user.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/api/user.go b/api/user.go
index a9c8a0065..5aba21e79 100644
--- a/api/user.go
+++ b/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)
}