diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-08-02 12:53:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-02 12:53:01 -0700 |
commit | 873e4f49038746b71ab9997fc10c89192ec1cd16 (patch) | |
tree | cd4e2232792f2c4ff82941a3a6297d78c94555bb /api/user.go | |
parent | 76bfd279b34f960149dba15424593dfd5fbfb956 (diff) | |
parent | fa3dd6a84bb51e8a5c3d3183bdb692386bb77c5a (diff) | |
download | chat-873e4f49038746b71ab9997fc10c89192ec1cd16.tar.gz chat-873e4f49038746b71ab9997fc10c89192ec1cd16.tar.bz2 chat-873e4f49038746b71ab9997fc10c89192ec1cd16.zip |
Merge pull request #7085 from saturninoabril/merge-4.0.2
Merge 4.0.2
Diffstat (limited to 'api/user.go')
-rw-r--r-- | api/user.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/api/user.go b/api/user.go index 0b2fbfba8..bb63cc7e2 100644 --- a/api/user.go +++ b/api/user.go @@ -1202,9 +1202,15 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) { relayProps = model.MapFromJson(strings.NewReader(stateStr)) } + action := relayProps["action"] if user, err := samlInterface.DoLogin(encodedXML, relayProps); err != nil { - c.Err = err - c.Err.StatusCode = http.StatusFound + if action == model.OAUTH_ACTION_MOBILE { + err.Translate(c.T) + w.Write([]byte(err.ToJson())) + } else { + c.Err = err + c.Err.StatusCode = http.StatusFound + } return } else { if err := app.CheckUserAdditionalAuthenticationCriteria(user, ""); err != nil { @@ -1212,7 +1218,7 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) { c.Err.StatusCode = http.StatusFound return } - action := relayProps["action"] + switch action { case model.OAUTH_ACTION_SIGNUP: teamId := relayProps["team_id"] @@ -1243,8 +1249,8 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) { return } - if action == "mobile" { - w.Write([]byte("")) + if action == model.OAUTH_ACTION_MOBILE { + ReturnStatusOK(w) } else { http.Redirect(w, r, app.GetProtocol(r)+"://"+r.Host, http.StatusFound) } |