Skip to content

Commit

Permalink
fixed mailgun validate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jsayles committed Dec 14, 2020
1 parent 06c5150 commit 37898f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nadine/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from localflavor.us.us_states import US_STATES
from localflavor.ca.ca_provinces import PROVINCE_CHOICES

from comlink import mailgun
from comlink.mailgun import MailgunAPI

from nadine.models.core import HowHeard, Industry, Neighborhood, URLType, GENDER_CHOICES
from nadine.models.profile import UserProfile, MemberNote, user_photo_path
Expand Down Expand Up @@ -218,6 +218,7 @@ def clean_email(self):
email = self.cleaned_data['email'].strip().lower()
if User.objects.filter(email=email).count() > 0:
raise forms.ValidationError(_("Email address '%s' already in use.") % email)
mailgun = MailgunAPI()
if not mailgun.validate_address(email):
raise forms.ValidationError(_("Email address '%s' is not valid.") % email)
return email
Expand Down

0 comments on commit 37898f1

Please sign in to comment.