mirror of https://github.com/zulip/zulip.git
Don't duplicate realm query when registering
(imported from commit b1e3b7144f564c5b2fc23fbf548bf0672deb2932)
This commit is contained in:
parent
97e3c36d4b
commit
48ec15c46d
|
@ -101,12 +101,13 @@ def register(request):
|
|||
full_name = strip_html(form.cleaned_data['full_name'])
|
||||
short_name = strip_html(email.split('@')[0])
|
||||
domain = strip_html(form.cleaned_data['domain'])
|
||||
realm = Realm.objects.filter(domain=domain)
|
||||
if not realm:
|
||||
|
||||
try:
|
||||
realm = Realm.objects.get(domain=domain)
|
||||
except Realm.DoesNotExist:
|
||||
realm = Realm(domain=domain)
|
||||
realm.save()
|
||||
else:
|
||||
realm = Realm.objects.get(domain=domain)
|
||||
|
||||
# FIXME: sanitize email addresses
|
||||
create_user(email, password, realm, full_name, short_name)
|
||||
login(request, authenticate(username=email, password=password))
|
||||
|
|
Loading…
Reference in New Issue