realm creation flow: Allow signups from all emails.

This (1) removes the check on whether the domain of the email matches
the Realm.domain of an existing realm and (2) avoids setting `realm =
get_realm(domain)` in the realm creation flow, which would cause the
wrong code path to be followed in the event that the domain in a
user's email address happens to match a deactivated realm.
This commit is contained in:
Tim Abbott 2016-10-28 22:59:01 -07:00
parent 1944ac844a
commit dd008ae559
2 changed files with 5 additions and 9 deletions

View File

@ -171,14 +171,6 @@ class RealmCreationForm(forms.Form):
del kwargs["domain"]
super(RealmCreationForm, self).__init__(*args, **kwargs)
def clean_email(self):
# type: () -> text_type
data = self.cleaned_data['email']
domain = split_email_to_domain(data)
if (get_realm(domain) is not None):
raise ValidationError(mark_safe(get_registration_string(domain)))
return data
class LoggingSetPasswordForm(SetPasswordForm):
def save(self, commit=True):
# type: (bool) -> UserProfile

View File

@ -118,11 +118,15 @@ def accounts_register(request):
# realm.
domain = prereg_user.realm.domain
realm = get_realm(domain)
elif realm_creation:
# For creating a new realm, there is no existing realm or domain
realm = None
domain = None
elif settings.REALMS_HAVE_SUBDOMAINS:
subdomain_realm = resolve_subdomain_to_realm(get_subdomain(request))
domain = resolve_email_to_domain(email)
domain = subdomain_realm.domain if subdomain_realm else domain
if (not realm_creation and completely_open(domain)):
if completely_open(domain):
# When subdomains are enabled and the user is registering into a
# completely open subdomain without going through the correct url
# for the completely open domains.