mirror of https://github.com/zulip/zulip.git
register: Activate existing mirror dummy only if on same realm.
The one thing this bit of logic is used for is to decide whether there's an existing user which is a mirror dummy that we should activate. This change causes us to ignore such an existing user if it's on some other realm, and go straight into `do_create_user`.
This commit is contained in:
parent
eb8b05b2b5
commit
5f38b374b6
|
@ -14,7 +14,7 @@ from django.core import validators
|
||||||
from zerver.context_processors import get_realm_from_request
|
from zerver.context_processors import get_realm_from_request
|
||||||
from zerver.models import UserProfile, Realm, Stream, MultiuseInvite, \
|
from zerver.models import UserProfile, Realm, Stream, MultiuseInvite, \
|
||||||
name_changes_disabled, email_to_username, email_allowed_for_realm, \
|
name_changes_disabled, email_to_username, email_allowed_for_realm, \
|
||||||
get_realm, get_user_profile_by_email, get_default_stream_groups
|
get_realm, get_user, get_default_stream_groups
|
||||||
from zerver.lib.send_email import send_email, FromAddress
|
from zerver.lib.send_email import send_email, FromAddress
|
||||||
from zerver.lib.events import do_events_register
|
from zerver.lib.events import do_events_register
|
||||||
from zerver.lib.actions import do_change_password, do_change_full_name, do_change_is_admin, \
|
from zerver.lib.actions import do_change_password, do_change_full_name, do_change_is_admin, \
|
||||||
|
@ -168,10 +168,13 @@ def accounts_register(request: HttpRequest) -> HttpResponse:
|
||||||
if 'timezone' in request.POST and request.POST['timezone'] in get_all_timezones():
|
if 'timezone' in request.POST and request.POST['timezone'] in get_all_timezones():
|
||||||
timezone = request.POST['timezone']
|
timezone = request.POST['timezone']
|
||||||
|
|
||||||
|
if not realm_creation:
|
||||||
try:
|
try:
|
||||||
existing_user_profile = get_user_profile_by_email(email)
|
existing_user_profile = get_user(email, realm)
|
||||||
except UserProfile.DoesNotExist:
|
except UserProfile.DoesNotExist:
|
||||||
existing_user_profile = None
|
existing_user_profile = None
|
||||||
|
else:
|
||||||
|
existing_user_profile = None
|
||||||
|
|
||||||
return_data = {} # type: Dict[str, bool]
|
return_data = {} # type: Dict[str, bool]
|
||||||
if ldap_auth_enabled(realm):
|
if ldap_auth_enabled(realm):
|
||||||
|
|
Loading…
Reference in New Issue