mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-04 14:46:57 -05:00
bug fixed #193
This commit is contained in:
parent
4f042d12bd
commit
f4486f3eec
@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/go-xorm/xorm"
|
"github.com/go-xorm/xorm"
|
||||||
|
|
||||||
"github.com/gogits/gogs/modules/auth/ldap"
|
"github.com/gogits/gogs/modules/auth/ldap"
|
||||||
|
"github.com/gogits/gogs/modules/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Login types.
|
// Login types.
|
||||||
@ -194,14 +195,17 @@ func LoginUser(uname, passwd string) (*User, error) {
|
|||||||
u, err := LoginUserLdapSource(nil, uname, passwd,
|
u, err := LoginUserLdapSource(nil, uname, passwd,
|
||||||
source.Id, source.Cfg.(*LDAPConfig), true)
|
source.Id, source.Cfg.(*LDAPConfig), true)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return u, err
|
return u, nil
|
||||||
|
} else {
|
||||||
|
log.Warn("try ldap login", source.Name, "by", uname, "error:", err)
|
||||||
}
|
}
|
||||||
} else if source.Type == LT_SMTP {
|
} else if source.Type == LT_SMTP {
|
||||||
u, err := LoginUserSMTPSource(nil, uname, passwd,
|
u, err := LoginUserSMTPSource(nil, uname, passwd,
|
||||||
source.Id, source.Cfg.(*SMTPConfig), true)
|
source.Id, source.Cfg.(*SMTPConfig), true)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return u, err
|
return u, nil
|
||||||
|
} else {
|
||||||
|
log.Warn("try smtp login", source.Name, "by", uname, "error:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u := models.LoginSource{
|
u := models.LoginSource{
|
||||||
|
Id: form.Id,
|
||||||
Name: form.AuthName,
|
Name: form.AuthName,
|
||||||
IsActived: form.IsActived,
|
IsActived: form.IsActived,
|
||||||
Type: form.Type,
|
Type: form.Type,
|
||||||
|
Loading…
Reference in New Issue
Block a user