From 3928535456f9fcb025ed86edeb4d258f2c524150 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Wed, 11 May 2016 11:04:30 -0700 Subject: PLT-2905 fixing upgrade of SSO accounts (#2962) * PLT-2905 fixing upgrade of SSO accounts * Fixing multiple Auths mapped to different emails --- api/oauth.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'api/oauth.go') diff --git a/api/oauth.go b/api/oauth.go index 0375f4e6f..37ca5ce0a 100644 --- a/api/oauth.go +++ b/api/oauth.go @@ -600,8 +600,11 @@ func CompleteSwitchWithOAuth(c *Context, w http.ResponseWriter, r *http.Request, return } else { ssoUser := provider.GetUserFromJson(userData) - authData = ssoUser.AuthData ssoEmail = ssoUser.Email + + if ssoUser.AuthData != nil { + authData = *ssoUser.AuthData + } } if len(authData) == 0 { @@ -628,7 +631,7 @@ func CompleteSwitchWithOAuth(c *Context, w http.ResponseWriter, r *http.Request, return } - if result := <-Srv.Store.User().UpdateAuthData(user.Id, service, authData, ssoEmail); result.Err != nil { + if result := <-Srv.Store.User().UpdateAuthData(user.Id, service, &authData, ssoEmail); result.Err != nil { c.Err = result.Err return } -- cgit v1.2.3-1-g7c22