summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-02-04 09:24:41 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2016-02-04 09:24:41 -0500
commit5e83be02baceca6f386115fe20475f593c90ee3c (patch)
tree6381fc04fe3964f382a6d4f4ead9260b41378349 /api
parent87e6357265422cc8549c39bc3fe3b52c6731fba5 (diff)
parenta4e7d02cec91613792e1f2c79d3919018d999e32 (diff)
downloadchat-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.go7
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
}