Skip to content

Commit 9484a3b

Browse files
merge: PR #459 update password minimum policy
2 parents 5ee23f2 + cf92d1f commit 9484a3b

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

‎backend/validators.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class RegisterRequest(BaseModel):
185185
"""Request schema for POST /api/v1/register endpoint."""
186186
username: str = Field(..., min_length=3, max_length=50, description="Username (3-50 characters)")
187187
email: EmailStr = Field(..., description="Valid email address")
188-
password: str = Field(..., min_length=6, max_length=100, description="Password (minimum 6 characters)")
188+
password: str = Field(..., min_length=8, max_length=100, description="Password (minimum 8 characters)")
189189

190190
@field_validator('username')
191191
@classmethod
@@ -196,7 +196,6 @@ def username_alphanumeric(cls, v: str) -> str:
196196
raise ValueError('Username must contain only letters, numbers, and underscores.')
197197
return v
198198

199-
200199
class LoginRequest(BaseModel):
201200
"""Request schema for POST /api/v1/login endpoint."""
202201
username: str = Field(..., min_length=1, description="Username or email")

‎scratch/test_username.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
def test_username(username):
1515
print(f"Testing username: '{username}'")
16-
data = {"username": username, "email": "test@example.com", "password": "password123"}
16+
data = {"username": username, "email": "test@example.com", "password": "Password123!"}
1717
is_valid, result = validate_request(RegisterRequest, data)
1818
if is_valid:
1919
print(f"[VALID] {result.username}")

‎tests/test_validation.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def main():
134134
test_validator(
135135
RegisterRequest,
136136
"RegisterRequest",
137-
{"username": "testuser", "email": "test@example.com", "password": "password123"},
137+
{"username": "testuser", "email": "test@example.com", "password": "Password123!"},
138138
{"username": "ab", "email": "invalid-email", "password": "123"}
139139
)
140140

0 commit comments

Comments
 (0)