bcrypt pwd legth decreased <70
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-09-26 06:58:07 +09:00
parent 24c1a0c85c
commit 31c1644ec2
3 changed files with 42 additions and 5 deletions

View File

@@ -82,7 +82,18 @@ async def register_user(user_data: UserCreate, db: AsyncSession = Depends(get_db
)
# Create new user
hashed_password = get_password_hash(user_data.password)
try:
hashed_password = get_password_hash(user_data.password)
except ValueError as e:
if "password cannot be longer than 72 bytes" in str(e):
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="Password is too long. Please use a shorter password (max 70 characters)."
)
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=f"Password validation error: {str(e)}"
)
# Используем phone_number как запасной вариант для phone
phone = user_data.phone or user_data.phone_number