Compare commits

...

4 Commits

Author SHA1 Message Date
Konstantin Nezhbert
0ffb58cfe9
Merge 5dd44dad7f208f4e4035daacae33ff2bde7d70dc into 0680b4ff05a4e7b385416f3d87b5e0d234de8e7c 2025-01-17 18:12:07 +02:00
Dmitry Shurupov
0680b4ff05
Merge pull request #293 from ogumemura/patch-1
Fix username validation regex to correctly recognize hyphen (-)
2025-01-10 11:31:42 +07:00
Shobu UMEMURA
8fc518dba8
Fix username validation regex to correctly recognize hyphen (-)
This pull request corrects the regular expression used for username validation to correctly recognize hyphens (-).

Changes Made:
Changed the regex pattern from ^([a-zA-Z0-9_.-@])+$ to ^([a-zA-Z0-9_.\-@])+$.

Reason for Change:
In the previous regex, the hyphen (-) within the character class was interpreted as a range operator, not as a literal character. This caused usernames with hyphens to be incorrectly marked as invalid.
By escaping the hyphen (\-), the regex now correctly recognizes it as a literal character. This ensures that usernames containing hyphens are validated properly.

Points of Verification:
Confirmed that usernames containing hyphens are now correctly recognized and pass the validation.
Verified that other characters (letters, numbers, underscores, dots, and at signs) are still being properly validated.
2024-09-28 17:57:02 +09:00
Zhbert
5dd44dad7f
Update alpine version 2024-05-02 16:34:15 +03:00
3 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ COPY . /app
ARG TARGETARCH ARG TARGETARCH
RUN cd /app && packr2 && env CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -a -tags netgo -ldflags '-linkmode external -extldflags -static -s -w' -o ovpn-admin && packr2 clean RUN cd /app && packr2 && env CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -a -tags netgo -ldflags '-linkmode external -extldflags -static -s -w' -o ovpn-admin && packr2 clean
FROM alpine:3.16 FROM alpine:3.19
WORKDIR /app WORKDIR /app
COPY --from=backend-builder /app/ovpn-admin /app COPY --from=backend-builder /app/ovpn-admin /app
ARG TARGETARCH ARG TARGETARCH

View File

@ -1,4 +1,4 @@
FROM alpine:3.16 FROM alpine:3.19
ARG TARGETARCH ARG TARGETARCH
RUN apk add --update bash openvpn easy-rsa iptables && \ RUN apk add --update bash openvpn easy-rsa iptables && \
ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \ ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \

View File

@ -34,7 +34,7 @@ import (
) )
const ( const (
usernameRegexp = `^([a-zA-Z0-9_.-@])+$` usernameRegexp = `^([a-zA-Z0-9_.\-@])+$`
passwordMinLength = 6 passwordMinLength = 6
certsArchiveFileName = "certs.tar.gz" certsArchiveFileName = "certs.tar.gz"
ccdArchiveFileName = "ccd.tar.gz" ccdArchiveFileName = "ccd.tar.gz"