dev_login: Don't redirect to realm if it doesn't exist.

Fixes #7132.
This commit is contained in:
darshanime
2017-10-24 00:03:56 +05:30
committed by Tim Abbott
parent a9a9333b2a
commit a14ec17473

View File

@@ -512,8 +512,9 @@ def login_page(request, **kwargs):
extra_context['direct_admins'] = [u for u in users if u.is_realm_admin]
extra_context['direct_users'] = [u for u in users if not u.is_realm_admin]
if 'new_realm' in request.POST:
# If we're switching realms, redirect to that realm
if realm and 'new_realm' in request.POST:
# If we're switching realms, redirect to that realm, but
# only if it actually exists.
return HttpResponseRedirect(realm.uri)
try: