diff options
author | Yi EungJun <eungjun.yi@navercorp.com> | 2015-12-01 16:39:27 +0900 |
---|---|---|
committer | Yi EungJun <eungjun.yi@navercorp.com> | 2015-12-02 13:23:57 +0900 |
commit | 6d63f5703c1849b688aaef6570e9b366b70eefab (patch) | |
tree | 25a15f2846dca5076bdfd694715d28ac67723ebb /model/gitlab.go | |
parent | 91c092cc21a0401547c51c026fa54699a4791234 (diff) | |
download | chat-6d63f5703c1849b688aaef6570e9b366b70eefab.tar.gz chat-6d63f5703c1849b688aaef6570e9b366b70eefab.tar.bz2 chat-6d63f5703c1849b688aaef6570e9b366b70eefab.zip |
Make the Gitlab SSO Support compatible with Github Enterprise
See doc/integrations/Single-Sign-On/Github.md for the usage.
Note: I thought it should work also with Github.com but it failed with "Bad
token type" error.
Diffstat (limited to 'model/gitlab.go')
-rw-r--r-- | model/gitlab.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/model/gitlab.go b/model/gitlab.go index 9f86c7b72..2a8756807 100644 --- a/model/gitlab.go +++ b/model/gitlab.go @@ -17,13 +17,18 @@ const ( type GitLabUser struct { Id int64 `json:"id"` Username string `json:"username"` + Login string `json:"login"` Email string `json:"email"` Name string `json:"name"` } func UserFromGitLabUser(glu *GitLabUser) *User { user := &User{} - user.Username = CleanUsername(glu.Username) + username := glu.Username + if username == "" { + username = glu.Login + } + user.Username = CleanUsername(username) splitName := strings.Split(glu.Name, " ") if len(splitName) == 2 { user.FirstName = splitName[0] |