Allow open realm signups with non-real-user MIT addresses.

This allows me to use a mail alias with CUSTOMER3, and closes #1671.

(imported from commit 581d1145fb112b9d35ad522fa06f81a25b4b8d3b)
This commit is contained in:
Luke Faraone 2013-08-11 15:55:24 -07:00
parent cb2e993393
commit f3c8806d30
1 changed files with 4 additions and 2 deletions

View File

@ -34,11 +34,13 @@ def not_mit_mailing_list(value):
# Check whether the user exists and can get mail.
try:
DNS.dnslookup("%s.pobox.ns.athena.mit.edu" % username, DNS.Type.TXT)
return True
except DNS.Base.ServerError, e:
if e.rcode == DNS.Status.NXDOMAIN:
raise ValidationError(mark_safe(u'That user does not exist at MIT or is a <a href="https://ist.mit.edu/email-lists">mailing list</a>. If you want to sign up an alias for Zulip, <a href="mailto:support@zulip.com">contact us</a>.'))
else:
raise
return True
class RegistrationForm(forms.Form):
full_name = forms.CharField(max_length=100)
@ -56,7 +58,7 @@ class HomepageForm(forms.Form):
if settings.ALLOW_REGISTER:
email = forms.EmailField()
else:
validators = [not_mit_mailing_list, is_inactive]
validators = [is_inactive]
email = forms.EmailField(validators=validators)
def __init__(self, *args, **kwargs):
@ -67,7 +69,7 @@ class HomepageForm(forms.Form):
def clean_email(self):
data = self.cleaned_data['email']
if completely_open(self.domain) or has_valid_realm(data):
if completely_open(self.domain) or has_valid_realm(data) and not_mit_mailing_list(data):
return data
raise ValidationError(mark_safe(
u'Registration is not currently available for your domain. ' \