feat: passwords need 8 characters or more, on the Site and in the Kanban
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 3m28s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m2s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-19 15:31:59 -03:00
parent ea3c20ba1e
commit 12d5ba8d15
8 changed files with 27 additions and 23 deletions

View File

@@ -26,7 +26,7 @@ class UserIn(StrictModel):
name: str = Field(min_length=1, max_length=80)
email: str = Field(min_length=3, max_length=254)
role: Literal['admin', 'gestao', 'operador', 'vendedor']
password: str | None = Field(default=None, min_length=12, max_length=128)
password: str | None = Field(default=None, min_length=8, max_length=128)
active: bool = True
machines: list[UUID] = Field(default_factory=list, max_length=50)
# The team's alerts by e-mail: orders paid, carts waiting for review, payments to look at.
@@ -49,7 +49,7 @@ class MachineIn(StrictModel):
class PasswordChange(StrictModel):
current: str = Field(min_length=1, max_length=128)
new: str = Field(min_length=12, max_length=128)
new: str = Field(min_length=8, max_length=128)
@router.get('/api/operator/me')
@@ -112,7 +112,7 @@ def set_machines(c, uid, machines):
@router.post('/api/operator/users')
def create_user(body: UserIn, request: Request, user=Depends(can('users'))):
if not body.password:
raise HTTPException(422, 'Defina uma senha inicial com 12 caracteres ou mais.')
raise HTTPException(422, 'Defina uma senha inicial com 8 caracteres ou mais.')
uid = uuid4()
with db.connect() as c:
if c.execute('SELECT 1 FROM dtf_local.operators WHERE email=%s', (body.email,)).fetchone():

View File

@@ -255,7 +255,7 @@ class Resolution(StrictModel):
class Register(StrictModel):
customer: Customer
password: str = Field(min_length=12, max_length=128)
password: str = Field(min_length=8, max_length=128)
class ProfileUpdate(StrictModel):
"""What a customer may change about their account; the CPF/CNPJ is not among it."""
@@ -290,7 +290,7 @@ class EmailChange(StrictModel):
class PasswordChange(StrictModel):
current: str = Field(min_length=1, max_length=128)
new: str = Field(min_length=12, max_length=128)
new: str = Field(min_length=8, max_length=128)
class SignupCode(StrictModel):
signup: UUID
@@ -311,7 +311,7 @@ class ForgotPassword(StrictModel):
class PasswordReset(StrictModel):
token: str = Field(min_length=20, max_length=100, pattern=r'^[A-Za-z0-9_-]+$')
password: str = Field(min_length=12, max_length=128)
password: str = Field(min_length=8, max_length=128)
class Login(StrictModel):
email: str = Field(min_length=3, max_length=254)

View File

@@ -28,7 +28,7 @@ from uuid import uuid4
from .core.auth import ROLES, password_hash
from .core.db import connect
MIN_PASSWORD = 12
MIN_PASSWORD = 8
def seed_from_environment(cursor):