diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-02-04 09:24:41 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-02-04 09:24:41 -0500 |
commit | 5e83be02baceca6f386115fe20475f593c90ee3c (patch) | |
tree | 6381fc04fe3964f382a6d4f4ead9260b41378349 /api | |
parent | 87e6357265422cc8549c39bc3fe3b52c6731fba5 (diff) | |
parent | a4e7d02cec91613792e1f2c79d3919018d999e32 (diff) | |
download | chat-5e83be02baceca6f386115fe20475f593c90ee3c.tar.gz chat-5e83be02baceca6f386115fe20475f593c90ee3c.tar.bz2 chat-5e83be02baceca6f386115fe20475f593c90ee3c.zip |
Merge pull request #2059 from mattermost/plt-1732
PLT-1732 Update user email when switching to SSO
Diffstat (limited to 'api')
-rw-r--r-- | api/user.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/api/user.go b/api/user.go index 91c8c022a..8b2df7143 100644 --- a/api/user.go +++ b/api/user.go @@ -2087,13 +2087,16 @@ func switchToSSO(c *Context, w http.ResponseWriter, r *http.Request) { func CompleteSwitchWithOAuth(c *Context, w http.ResponseWriter, r *http.Request, service string, userData io.ReadCloser, team *model.Team, email string) { authData := "" + ssoEmail := "" provider := einterfaces.GetOauthProvider(service) if provider == nil { c.Err = model.NewLocAppError("CompleteClaimWithOAuth", "api.user.complete_switch_with_oauth.unavailable.app_error", map[string]interface{}{"Service": service}, "") return } else { - authData = provider.GetAuthDataFromJson(userData) + ssoUser := provider.GetUserFromJson(userData) + authData = ssoUser.AuthData + ssoEmail = ssoUser.Email } if len(authData) == 0 { @@ -2120,7 +2123,7 @@ func CompleteSwitchWithOAuth(c *Context, w http.ResponseWriter, r *http.Request, return } - if result := <-Srv.Store.User().UpdateAuthData(user.Id, service, authData); result.Err != nil { + if result := <-Srv.Store.User().UpdateAuthData(user.Id, service, authData, ssoEmail); result.Err != nil { c.Err = result.Err return } |