Allow dots in umbral name validation (matches username regex)
Username validation allows dots ([a-z0-9_.\-]+) but the connection search and umbral name validators used [a-zA-Z0-9_-] which rejected dots. This caused a 422 on any search for users with dots in their username (e.g. rca.account01), silently showing "User not found". Fixed regex in both connection.py schema and auth.py ProfileUpdate to include dots: [a-zA-Z0-9_.-] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9bcf5ace5d
commit
416f616457
@ -182,8 +182,8 @@ class ProfileUpdate(BaseModel):
|
||||
import re
|
||||
if ' ' in v:
|
||||
raise ValueError('Umbral name must be a single word with no spaces')
|
||||
if not re.match(r'^[a-zA-Z0-9_-]{3,50}$', v):
|
||||
raise ValueError('Umbral name must be 3-50 alphanumeric characters, hyphens, or underscores')
|
||||
if not re.match(r'^[a-zA-Z0-9_.-]{3,50}$', v):
|
||||
raise ValueError('Umbral name must be 3-50 alphanumeric characters, dots, hyphens, or underscores')
|
||||
return v
|
||||
|
||||
@field_validator("email")
|
||||
|
||||
@ -8,7 +8,7 @@ from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
_UMBRAL_NAME_RE = re.compile(r'^[a-zA-Z0-9_-]{3,50}$')
|
||||
_UMBRAL_NAME_RE = re.compile(r'^[a-zA-Z0-9_.-]{3,50}$')
|
||||
|
||||
|
||||
class UmbralSearchRequest(BaseModel):
|
||||
@ -19,7 +19,7 @@ class UmbralSearchRequest(BaseModel):
|
||||
@classmethod
|
||||
def validate_umbral_name(cls, v: str) -> str:
|
||||
if not _UMBRAL_NAME_RE.match(v):
|
||||
raise ValueError('Umbral name must be 3-50 alphanumeric characters, hyphens, or underscores')
|
||||
raise ValueError('Umbral name must be 3-50 alphanumeric characters, dots, hyphens, or underscores')
|
||||
return v
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class SendConnectionRequest(BaseModel):
|
||||
@classmethod
|
||||
def validate_umbral_name(cls, v: str) -> str:
|
||||
if not _UMBRAL_NAME_RE.match(v):
|
||||
raise ValueError('Umbral name must be 3-50 alphanumeric characters, hyphens, or underscores')
|
||||
raise ValueError('Umbral name must be 3-50 alphanumeric characters, dots, hyphens, or underscores')
|
||||
return v
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user