File size: 344 Bytes
e2bdc52
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
# utils/validators.py
import re

EMAIL_RE = re.compile(r"^[\w\.-]+@[\w\.-]+\.\w+$")
PWD_RE = re.compile(r"^(?=.*[0-9])(?=.*[!@#$%^&*()_+\-=\[\]{};':\"\\|,.<>\/?]).{8,}$")

def valid_email(email: str) -> bool:
    return EMAIL_RE.match(email) is not None

def valid_password(password: str) -> bool:
    return PWD_RE.match(password) is not None