"fmt"
"net/smtp"
"net/textproto"
+ "regexp"
"strings"
"github.com/Unknwon/com"
- "github.com/go-macaron/binding"
"github.com/go-xorm/core"
"github.com/go-xorm/xorm"
}
}
+var (
+ alphaDashDotPattern = regexp.MustCompile("[^\\w-\\.]")
+)
+
// LoginViaLDAP queries if login/password is valid against the LDAP directory pool,
// and create a local user if success when enabled.
func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoRegister bool) (*User, error) {
sr.Username = login
}
// Validate username make sure it satisfies requirement.
- if binding.AlphaDashDotPattern.MatchString(sr.Username) {
+ if alphaDashDotPattern.MatchString(sr.Username) {
return nil, fmt.Errorf("Invalid pattern for attribute 'username' [%s]: must be valid alpha or numeric or dash(-_) or dot characters", sr.Username)
}
var templates *template.Template
-// InitMailRender initializes the macaron mail renderer
+// InitMailRender initializes the mail renderer
func InitMailRender(tmpls *template.Template) {
templates = tmpls
}