summaryrefslogtreecommitdiffstats
path: root/models/login.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-12 19:20:37 -0400
committerUnknwon <u@gogs.io>2015-09-12 19:20:37 -0400
commit6969c20afd136ac911c66fd7c7ed88d611ba79fc (patch)
tree74ca4bb78af05254692fda492078b4d2f570d8e2 /models/login.go
parentf4e54aafa5f9f7e64875f96e52fad406caf77826 (diff)
downloadgitea-6969c20afd136ac911c66fd7c7ed88d611ba79fc.tar.gz
gitea-6969c20afd136ac911c66fd7c7ed88d611ba79fc.zip
#1625 LDAP not working
Diffstat (limited to 'models/login.go')
-rw-r--r--models/login.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/models/login.go b/models/login.go
index c0fc20f383..27ef377069 100644
--- a/models/login.go
+++ b/models/login.go
@@ -224,14 +224,13 @@ func UserSignIn(uname, passwd string) (*User, error) {
if userExists {
switch u.LoginType {
- case NOTYPE:
- fallthrough
- case PLAIN:
+ case NOTYPE, PLAIN:
if u.ValidatePassword(passwd) {
return u, nil
}
return nil, ErrUserNotExist{u.Id, u.Name}
+
default:
var source LoginSource
hasSource, err := x.Id(u.LoginSource).Get(&source)
@@ -246,12 +245,12 @@ func UserSignIn(uname, passwd string) (*User, error) {
}
var sources []LoginSource
- if err = x.UseBool().Find(&sources, &LoginSource{IsActived: true, AllowAutoRegister: true}); err != nil {
+ if err = x.UseBool().Find(&sources, &LoginSource{IsActived: true}); err != nil {
return nil, err
}
for _, source := range sources {
- u, err := ExternalUserLogin(nil, uname, passwd, &source, true)
+ u, err := ExternalUserLogin(nil, uname, passwd, &source, source.AllowAutoRegister)
if err == nil {
return u, nil
}