From 83e78c6cd748a8a7a957643561900b6cae0d79a4 Mon Sep 17 00:00:00 2001 From: Konrad Wojas Date: Mon, 4 Jan 2021 22:14:23 +0800 Subject: [PATCH] Allow numbers in htpasswd usernames --- changelog/unreleased/issue-131 | 1 + htpasswd.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog/unreleased/issue-131 b/changelog/unreleased/issue-131 index 2c7877c..fffe7f8 100644 --- a/changelog/unreleased/issue-131 +++ b/changelog/unreleased/issue-131 @@ -13,4 +13,5 @@ curl -v -X DELETE -u foo/config:attack http://localhost:8000/foo/config https://github.com/restic/rest-server/issues/131 https://github.com/restic/rest-server/pull/132 +https://github.com/restic/rest-server/pull/137 diff --git a/htpasswd.go b/htpasswd.go index d319e05..c009c99 100644 --- a/htpasswd.go +++ b/htpasswd.go @@ -100,7 +100,7 @@ func (h *HtpasswdFile) throttleTimer() { } } -var validUsernameRegexp = regexp.MustCompile(`^[\p{L}@.-]+$`) +var validUsernameRegexp = regexp.MustCompile(`^[\p{L}\d@.-]+$`) // Reload reloads the htpasswd file. If the reload fails, the Users map is not changed and the error is returned. func (h *HtpasswdFile) Reload() error {