mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 15:43:21 +00:00
convert htpasswd regexes to globals
This commit is contained in:
parent
5a6ed2ffdf
commit
98f0aaca1c
1 changed files with 3 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue