fix: allow phone number as basic login

This commit is contained in:
richjohnrambo
2026-08-17 14:28:24 +08:00
parent cf590a1c78
commit 4ec84f961b
2 changed files with 45 additions and 3 deletions
+4 -3
View File
@@ -23,9 +23,10 @@ const (
defaultMinPasswordLength = 3
)
// Token suitable as a login: starts and ends with a Unicode letter (class L) or number (class N),
// contains Unicode letters, numbers, dot and underscore.
var loginPattern = regexp.MustCompile(`^[\pL\pN][_.\pL\pN]*[\pL\pN]+$`)
// Token suitable as a login: either an E.164 phone number or a name which starts
// and ends with a Unicode letter (class L) or number (class N), and contains
// Unicode letters, numbers, dot and underscore.
var loginPattern = regexp.MustCompile(`^(\+[\pN]+|[\pL\pN][_.\pL\pN]*[\pL\pN]+)$`)
// authenticator is the type to map authentication methods to.
type authenticator struct {