import re from utils.phone_utils import validate_indian_phone def validate_password_strength(password: str) -> list[str]: errors = [] if len(password) < 8: errors.append("Password must be at least 8 characters") if not re.search(r"[A-Z]", password): errors.append("Password must contain at least one uppercase letter") if not re.search(r"[a-z]", password): errors.append("Password must contain at least one lowercase letter") if not re.search(r"\d", password): errors.append("Password must contain at least one number") if not re.search(r"[!@#$%^&*(),.?\":{}|<>]", password): errors.append("Password must contain at least one special character") return errors def validate_email_format(email: str) -> bool: return bool(re.match(r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$", email)) def validate_gst_number(gst: str) -> bool: if not gst: return True return bool(re.match(r"^\d{2}[A-Z]{5}\d{4}[A-Z]\d[Z][A-Z\d]$", gst)) def sanitize_input(text: str) -> str: if not text: return "" text = text.strip() text = re.sub(r"<[^>]+>", "", text) return text