diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2018-06-27 01:23:13 +0100 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-06-26 17:23:13 -0700 |
commit | f17c15c9d83e42e46adb8e8c1fb9706b22fe6f50 (patch) | |
tree | 47fc7424a307efb78262526c5d795e0649964f14 /app/oauth.go | |
parent | 85aa3d664c32af0532113f554002a5d3192faf29 (diff) | |
download | chat-f17c15c9d83e42e46adb8e8c1fb9706b22fe6f50.tar.gz chat-f17c15c9d83e42e46adb8e8c1fb9706b22fe6f50.tar.bz2 chat-f17c15c9d83e42e46adb8e8c1fb9706b22fe6f50.zip |
Simplify oauth (#8972)
* Remove unused OauthProvider::GetIdentifier
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* Reuse gitlab's getAuthData() instead of open-coding it
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* Remove OauthProvider::GetAuthDataFromJson interface
The data is already available via GetUserFromJson().AuthData
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'app/oauth.go')
-rw-r--r-- | app/oauth.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/oauth.go b/app/oauth.go index 477c0aeaf..80fe4342e 100644 --- a/app/oauth.go +++ b/app/oauth.go @@ -457,7 +457,13 @@ func (a *App) LoginByOAuth(service string, userData io.Reader, teamId string) (* return nil, model.NewAppError("LoginByOAuth", "api.user.login_by_oauth.not_available.app_error", map[string]interface{}{"Service": strings.Title(service)}, "", http.StatusNotImplemented) } else { - authData = provider.GetAuthDataFromJson(bytes.NewReader(buf.Bytes())) + authUser := provider.GetUserFromJson(bytes.NewReader(buf.Bytes())) + + if authUser.AuthData != nil { + authData = *authUser.AuthData + } else { + authData = "" + } } if len(authData) == 0 { |