diff options
author | Corey Hulen <corey@hulen.com> | 2016-05-11 11:04:30 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-05-11 14:04:30 -0400 |
commit | 3928535456f9fcb025ed86edeb4d258f2c524150 (patch) | |
tree | 010f4bd298f23b92711affcdef81cc329c522e67 /api/oauth.go | |
parent | a574397a7256bed7738f499019f97ab468b5161d (diff) | |
download | chat-3928535456f9fcb025ed86edeb4d258f2c524150.tar.gz chat-3928535456f9fcb025ed86edeb4d258f2c524150.tar.bz2 chat-3928535456f9fcb025ed86edeb4d258f2c524150.zip |
PLT-2905 fixing upgrade of SSO accounts (#2962)
* PLT-2905 fixing upgrade of SSO accounts
* Fixing multiple Auths mapped to different emails
Diffstat (limited to 'api/oauth.go')
-rw-r--r-- | api/oauth.go | 7 |
1 files changed, 5 insertions, 2 deletions
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 } |