login: Fix unnecessary queries on /login/ in development.

This block of code with 2 database queries is solely for the /devlogin
endpoint.  Removing that block from the /login code path makes it
easier to test /login perf in development.
This commit is contained in:
Tim Abbott 2019-03-17 14:03:57 -07:00
parent 0a7b6909b9
commit f270e354b1
1 changed files with 1 additions and 1 deletions

View File

@ -678,7 +678,7 @@ def login_page(request: HttpRequest, **kwargs: Any) -> HttpResponse:
return redirect_to_deactivation_notice()
extra_context = kwargs.pop('extra_context', {})
if dev_auth_enabled():
if dev_auth_enabled() and kwargs.get("template_name") == "zerver/dev_login.html":
if 'new_realm' in request.POST:
realm = get_realm(request.POST['new_realm'])