mirror of
https://github.com/restic/rest-server.git
synced 2025-12-06 17:15:45 -08:00
convert htpasswd regexes to globals
This commit is contained in:
committed by
Leo R. Lundgren
parent
5a6ed2ffdf
commit
98f0aaca1c
@@ -211,6 +211,9 @@ func (h *HtpasswdFile) ReloadCheck() error {
|
|||||||
return nil
|
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
|
// 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.
|
// password is wrong, false is returned.
|
||||||
func (h *HtpasswdFile) Validate(user string, password string) bool {
|
func (h *HtpasswdFile) Validate(user string, password string) bool {
|
||||||
@@ -245,9 +248,6 @@ func (h *HtpasswdFile) Validate(user string, password string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
var shaRe = regexp.MustCompile(`^{SHA}`)
|
|
||||||
var bcrRe = regexp.MustCompile(`^\$2b\$|^\$2a\$|^\$2y\$`)
|
|
||||||
|
|
||||||
isValid := false
|
isValid := false
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
|||||||
Reference in New Issue
Block a user