diff options
author | Sergio Benitez <sbenitez@mit.edu> | 2015-08-12 16:58:27 -0700 |
---|---|---|
committer | Sergio Benitez <sbenitez@mit.edu> | 2015-08-12 17:01:22 -0700 |
commit | 7d84d4a8f0cb30df04241f528ed74672a485274a (patch) | |
tree | e42a4d0163ac9573a75ea47e6659a8761e78d936 /models/login.go | |
parent | 631c85ba4f51d3fe910324595c154dfaf25935d2 (diff) | |
download | gitea-7d84d4a8f0cb30df04241f528ed74672a485274a.tar.gz gitea-7d84d4a8f0cb30df04241f528ed74672a485274a.zip |
Significantly enhanced LDAP support in Gogs.
Diffstat (limited to 'models/login.go')
-rw-r--r-- | models/login.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/models/login.go b/models/login.go index 82cea35f4c..8ac4b827ef 100644 --- a/models/login.go +++ b/models/login.go @@ -19,7 +19,6 @@ import ( "github.com/gogits/gogs/modules/auth/ldap" "github.com/gogits/gogs/modules/auth/pam" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/uuid" ) type LoginType int @@ -258,18 +257,19 @@ func UserSignIn(uname, passwd string) (*User, error) { // Return the same LoginUserPlain semantic // FIXME: https://github.com/gogits/gogs/issues/672 func LoginUserLdapSource(u *User, name, passwd string, sourceId int64, cfg *LDAPConfig, autoRegister bool) (*User, error) { - name, fn, sn, mail, logged := cfg.Ldapsource.SearchEntry(name, passwd) + fn, sn, mail, logged := cfg.Ldapsource.SearchEntry(name, passwd) if !logged { // User not in LDAP, do nothing - return nil, ErrUserNotExist{u.Id, u.Name} + return nil, ErrUserNotExist{0, name} } + if !autoRegister { return u, nil } // Fallback. if len(mail) == 0 { - mail = uuid.NewV4().String() + "@localhost" + mail = fmt.Sprintf("%s@localhost", name) } u = &User{ |