Compare commits

..

3 Commits

Author SHA1 Message Date
Vladislav
510e222b83
Merge 57adf569a26a66efcad7d9f2b94cdb0de2ff54db into 0680b4ff05a4e7b385416f3d87b5e0d234de8e7c 2025-01-10 15:02:56 +05:30
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

View File

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