summaryrefslogtreecommitdiffstats
path: root/api/user.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-02-04 10:55:44 -0800
committer=Corey Hulen <corey@hulen.com>2016-02-04 10:55:44 -0800
commitcfd4e4de963703191e750ba0abb901c5f6c0c3e4 (patch)
treed01a656eeeaba9603568a54a164f378608c4a939 /api/user.go
parentf1bf70624288bd192b9523764f239eee2a022304 (diff)
parent44c19ee443831e0e94b5738ecb21a64ce7643247 (diff)
downloadchat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.tar.gz
chat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.tar.bz2
chat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.zip
Merge branch 'master' into PLT-1851
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/api/user.go b/api/user.go
index 91c8c022a..9926f3ff3 100644
--- a/api/user.go
+++ b/api/user.go
@@ -1542,6 +1542,10 @@ func PermanentDeleteUser(c *Context, user *model.User) *model.AppError {
return result.Err
}
+ if result := <-Srv.Store.Command().PermanentDeleteByUser(user.Id); result.Err != nil {
+ return result.Err
+ }
+
if result := <-Srv.Store.Preference().PermanentDeleteByUser(user.Id); result.Err != nil {
return result.Err
}
@@ -2087,13 +2091,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 +2127,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
}