允许用户名中出现点号。

修改ldap登录的filter为可以配置。
This commit is contained in:
gefire
2017-06-13 18:02:50 +08:00
parent e7f8702c91
commit 3b4ac00943
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,
)