mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
basicauth: remove magic number (#1760)
This commit is contained in:
parent
0985024670
commit
aebe387f72
1 changed files with 3 additions and 2 deletions
|
@ -91,8 +91,9 @@ func basicAuthParse(c *caddy.Controller) ([]Rule, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func passwordMatcher(username, passw, siteRoot string) (PasswordMatcher, error) {
|
func passwordMatcher(username, passw, siteRoot string) (PasswordMatcher, error) {
|
||||||
if !strings.HasPrefix(passw, "htpasswd=") {
|
htpasswdPrefix := "htpasswd="
|
||||||
|
if !strings.HasPrefix(passw, htpasswdPrefix) {
|
||||||
return PlainMatcher(passw), nil
|
return PlainMatcher(passw), nil
|
||||||
}
|
}
|
||||||
return GetHtpasswdMatcher(passw[9:], username, siteRoot)
|
return GetHtpasswdMatcher(passw[len(htpasswdPrefix):], username, siteRoot)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue