diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-12 07:01:09 +0800 |
---|---|---|
committer | Thibault Meyer <0xbaadf00d@users.noreply.github.com> | 2016-11-12 00:01:09 +0100 |
commit | 555d8b16cb8670dd0a4e9094d26091eba6a6df36 (patch) | |
tree | 2a04105ef8d9f08b6c0634ce465eb0b5c7883bf0 /models/login_source.go | |
parent | 900f233b3cf3cfad59d9be04700f0100ad3cca56 (diff) | |
download | gitea-555d8b16cb8670dd0a4e9094d26091eba6a6df36.tar.gz gitea-555d8b16cb8670dd0a4e9094d26091eba6a6df36.zip |
fixed bug #151 caused Find should be Get (#153)
Diffstat (limited to 'models/login_source.go')
-rw-r--r-- | models/login_source.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/models/login_source.go b/models/login_source.go index 0d9226a583..774cb7f4db 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -296,7 +296,7 @@ func LoginViaLDAP(user *User, login, passowrd string, source *LoginSource, autoR username, fn, sn, mail, isAdmin, succeed := source.Cfg.(*LDAPConfig).SearchEntry(login, passowrd, source.Type == LoginDLDAP) if !succeed { // User not in LDAP, do nothing - return nil, ErrUserNotExist{0, login} + return nil, ErrUserNotExist{0, login, 0} } if !autoRegister { @@ -404,9 +404,9 @@ func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPC if len(cfg.AllowedDomains) > 0 { idx := strings.Index(login, "@") if idx == -1 { - return nil, ErrUserNotExist{0, login} + return nil, ErrUserNotExist{0, login, 0} } else if !com.IsSliceContainsStr(strings.Split(cfg.AllowedDomains, ","), login[idx+1:]) { - return nil, ErrUserNotExist{0, login} + return nil, ErrUserNotExist{0, login, 0} } } @@ -425,7 +425,7 @@ func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPC tperr, ok := err.(*textproto.Error) if (ok && tperr.Code == 535) || strings.Contains(err.Error(), "Username and Password not accepted") { - return nil, ErrUserNotExist{0, login} + return nil, ErrUserNotExist{0, login, 0} } return nil, err } @@ -465,7 +465,7 @@ func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPC func LoginViaPAM(user *User, login, password string, sourceID int64, cfg *PAMConfig, autoRegister bool) (*User, error) { if err := pam.PAMAuth(cfg.ServiceName, login, password); err != nil { if strings.Contains(err.Error(), "Authentication failure") { - return nil, ErrUserNotExist{0, login} + return nil, ErrUserNotExist{0, login, 0} } return nil, err } @@ -525,7 +525,7 @@ func UserSignIn(username, passowrd string) (*User, error) { return user, nil } - return nil, ErrUserNotExist{user.ID, user.Name} + return nil, ErrUserNotExist{user.ID, user.Name, 0} default: var source LoginSource @@ -554,5 +554,5 @@ func UserSignIn(username, passowrd string) (*User, error) { log.Warn("Failed to login '%s' via '%s': %v", username, source.Name, err) } - return nil, ErrUserNotExist{user.ID, user.Name} + return nil, ErrUserNotExist{user.ID, user.Name, 0} } |