diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-05-14 21:52:18 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-05-14 09:52:18 -0400 |
commit | 24a536d1450f6214dda8bc87645b4c8643e9e173 (patch) | |
tree | 71b41e9f38bc1fbb426ecee50c4f1be4c6521b28 | |
parent | 8b36f01f453979d6b6ee14f9ac6e56fa6c7b035e (diff) | |
download | gitea-24a536d1450f6214dda8bc87645b4c8643e9e173.tar.gz gitea-24a536d1450f6214dda8bc87645b4c8643e9e173.zip |
Remove macaron dependent on models (#6940)
-rw-r--r-- | models/login_source.go | 8 | ||||
-rw-r--r-- | models/mail.go | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/models/login_source.go b/models/login_source.go index 69602b8b16..9b8173b84d 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -11,10 +11,10 @@ import ( "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" @@ -384,6 +384,10 @@ func composeFullName(firstname, surname, username string) string { } } +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) { @@ -408,7 +412,7 @@ func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoR 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) } diff --git a/models/mail.go b/models/mail.go index b3e1e0d833..6be0df95ba 100644 --- a/models/mail.go +++ b/models/mail.go @@ -33,7 +33,7 @@ const ( var templates *template.Template -// InitMailRender initializes the macaron mail renderer +// InitMailRender initializes the mail renderer func InitMailRender(tmpls *template.Template) { templates = tmpls } |