Selaa lähdekoodia

do not accept email without MX record

Son NK 5 vuotta sitten
vanhempi
commit
6acbf2f8dc
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 5 0
      app/email_utils.py

+ 5 - 0
app/email_utils.py

@@ -328,6 +328,11 @@ def can_be_used_as_personal_email(email: str) -> bool:
 
 
     # check if email MX domain is disposable
     # check if email MX domain is disposable
     mx_domains = get_mx_domain_list(domain)
     mx_domains = get_mx_domain_list(domain)
+
+    # if no MX record, email is not valid
+    if not mx_domains:
+        return False
+
     for mx_domain in mx_domains:
     for mx_domain in mx_domains:
         if is_disposable_domain(mx_domain):
         if is_disposable_domain(mx_domain):
             LOG.d("MX Domain %s %s is disposable", mx_domain, domain)
             LOG.d("MX Domain %s %s is disposable", mx_domain, domain)