Browse Source

#1625 LDAP not working

pull/1636/head
Unknwon 9 years ago
parent
commit
6969c20afd
  1. 9
      models/login.go

9
models/login.go

@ -224,14 +224,13 @@ func UserSignIn(uname, passwd string) (*User, error) {
if userExists { if userExists {
switch u.LoginType { switch u.LoginType {
case NOTYPE: case NOTYPE, PLAIN:
fallthrough
case PLAIN:
if u.ValidatePassword(passwd) { if u.ValidatePassword(passwd) {
return u, nil return u, nil
} }
return nil, ErrUserNotExist{u.Id, u.Name} return nil, ErrUserNotExist{u.Id, u.Name}
default: default:
var source LoginSource var source LoginSource
hasSource, err := x.Id(u.LoginSource).Get(&source) hasSource, err := x.Id(u.LoginSource).Get(&source)
@ -246,12 +245,12 @@ func UserSignIn(uname, passwd string) (*User, error) {
} }
var sources []LoginSource 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 return nil, err
} }
for _, source := range sources { for _, source := range sources {
u, err := ExternalUserLogin(nil, uname, passwd, &source, true) u, err := ExternalUserLogin(nil, uname, passwd, &source, source.AllowAutoRegister)
if err == nil { if err == nil {
return u, nil return u, nil
} }

Loading…
Cancel
Save