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.
Этот коммит содержится в:
Yi EungJun
2015-12-01 16:39:27 +09:00
родитель 91c092cc21
Коммит 6d63f5703c
2 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@@ -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]