This commit is contained in:
Minho
2017-06-14 09:42:33 +08:00
3 changed files with 7 additions and 2 deletions

View File

@@ -107,7 +107,8 @@ func (m *Member) ldapLogin(account string, password string) (*Member, error) {
searchRequest := ldap.NewSearchRequest(
beego.AppConfig.String("ldap_base"),
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
fmt.Sprintf("(&(objectClass=User)(%s=%s))", beego.AppConfig.String("ldap_attribute"), account),
//修改objectClass通过配置文件获取值
fmt.Sprintf("(&(%s)(%s=%s))",beego.AppConfig.String("ldap_filter"), beego.AppConfig.String("ldap_attribute"), account),
[]string{"dn", "mail"},
nil,
)