diff --git a/htpasswd.go b/htpasswd.go index 048a6c8..49febd3 100644 --- a/htpasswd.go +++ b/htpasswd.go @@ -211,6 +211,9 @@ func (h *HtpasswdFile) ReloadCheck() error { return nil } +var shaRe = regexp.MustCompile(`^{SHA}`) +var bcrRe = regexp.MustCompile(`^\$2b\$|^\$2a\$|^\$2y\$`) + // Validate returns true if password matches the stored password for user. If no password for user is stored, or the // password is wrong, false is returned. func (h *HtpasswdFile) Validate(user string, password string) bool { @@ -245,9 +248,6 @@ func (h *HtpasswdFile) Validate(user string, password string) bool { return true } - var shaRe = regexp.MustCompile(`^{SHA}`) - var bcrRe = regexp.MustCompile(`^\$2b\$|^\$2a\$|^\$2y\$`) - isValid := false switch {