def home(request: HttpRequest) -> HttpResponse: if not settings.ROOT_DOMAIN_LANDING_PAGE: return home_real(request) # If settings.ROOT_DOMAIN_LANDING_PAGE, sends the user the landing # page, not the login form, on the root domain subdomain = get_subdomain(request) if subdomain != Realm.SUBDOMAIN_FOR_ROOT_DOMAIN: return home_real(request) return hello_view(request)
def home(request: HttpRequest) -> HttpResponse: subdomain = get_subdomain(request) # If settings.ROOT_DOMAIN_LANDING_PAGE and this is the root # domain, send the user the landing page. if settings.ROOT_DOMAIN_LANDING_PAGE and subdomain == Realm.SUBDOMAIN_FOR_ROOT_DOMAIN: return hello_view(request) realm = get_realm_from_request(request) if realm is None: return render(request, "zerver/invalid_realm.html", status=404) if realm.allow_web_public_streams_access(): return web_public_view(home_real)(request) return zulip_login_required(home_real)(request)
def home(request: HttpRequest) -> HttpResponse: subdomain = get_subdomain(request) # If settings.ROOT_DOMAIN_LANDING_PAGE and this is the root # domain, send the user the landing page. if settings.ROOT_DOMAIN_LANDING_PAGE and subdomain == Realm.SUBDOMAIN_FOR_ROOT_DOMAIN: return hello_view(request) # TODO: The following logic is a bit hard to read. We save a # database query in the common case by avoiding the call to # `get_valid_realm_from_request` if user hasn't requested # web-public access. if (request.POST.get("prefers_web_public_view") == "true" or request.session.get("prefers_web_public_view") ) and get_valid_realm_from_request( request).allow_web_public_streams_access(): return web_public_view(home_real)(request) return zulip_login_required(home_real)(request)