mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
Fix support for having a unique, open realm.
The previous implementation didn't work because HomepageForm rejected the email as not having a domain. Additionally, the logic in accounts_register didn't work with Google auth because that code path doesn't pass through accounts_home. Since whether there's a unique open realm for the server is effectively a configuration property, we can fix the bug and make the logic clearer by moving it into the "figure out the user's realm" function.
This commit is contained in:
@@ -7,7 +7,7 @@ from django.contrib.auth.forms import SetPasswordForm, AuthenticationForm
|
||||
from django.conf import settings
|
||||
|
||||
from zerver.models import Realm, get_user_profile_by_email, UserProfile, \
|
||||
completely_open, resolve_email_to_domain, get_realm
|
||||
completely_open, resolve_email_to_domain, get_realm, get_unique_open_realm
|
||||
from zerver.lib.actions import do_change_password, is_inactive
|
||||
from zproject.backends import password_auth_enabled
|
||||
import DNS
|
||||
@@ -69,7 +69,9 @@ class HomepageForm(forms.Form):
|
||||
|
||||
def clean_email(self):
|
||||
data = self.cleaned_data['email']
|
||||
if completely_open(self.domain) or has_valid_realm(data) and not_mit_mailing_list(data):
|
||||
if (get_unique_open_realm() or
|
||||
completely_open(self.domain) or
|
||||
(has_valid_realm(data) and not_mit_mailing_list(data))):
|
||||
return data
|
||||
raise ValidationError(mark_safe(SIGNUP_STRING))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user