Add email and phone validation to request-access modal

This commit is contained in:
2026-05-14 06:29:37 +00:00
parent beb2781123
commit eb05bcac53
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -440,8 +440,13 @@ async def request_access(request: Request, db: Session = Depends(get_db)):
manager = str(data.get("manager", "")).strip()
products = data.get("products", [])
import re as _re
if not name or not company or not email or not phone:
raise HTTPException(status_code=422, detail="Заполните все обязательные поля")
if not _re.match(r'^[^\s@]+@[^\s@]+\.[^\s@]+$', email):
raise HTTPException(status_code=422, detail="Некорректный email")
if not _re.match(r'^[\+\d][\d\s\-\(\)]{6,18}$', phone):
raise HTTPException(status_code=422, detail="Некорректный номер телефона")
products_text = ""
if products: