student-admin / utils /validators.py
roshcheeku's picture
Create utils/validators.py
e2bdc52 verified
raw
history blame contribute delete
344 Bytes
# 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