mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
home: Redirect https://selfhosting.zuliphostname/ to /serverlogin/.
This is a reasonable default page to render for that hostname, and less confusing than "Organization does not exist."
This commit is contained in:
committed by
Tim Abbott
parent
adf9e8de3d
commit
b10c611840
@@ -1092,6 +1092,11 @@ class HomeTest(ZulipTestCase):
|
|||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertEqual(result["Location"], "http://testserver")
|
self.assertEqual(result["Location"], "http://testserver")
|
||||||
|
|
||||||
|
with patch("zerver.views.home.get_subdomain", return_value="selfhosting"):
|
||||||
|
result = self._get_home_page()
|
||||||
|
self.assertEqual(result.status_code, 302)
|
||||||
|
self.assertEqual(result["Location"], "/serverlogin/")
|
||||||
|
|
||||||
def send_test_message(
|
def send_test_message(
|
||||||
self,
|
self,
|
||||||
content: str,
|
content: str,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from typing import List, Optional, Tuple
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
|
from django.urls import reverse
|
||||||
from django.utils.cache import patch_cache_control
|
from django.utils.cache import patch_cache_control
|
||||||
|
|
||||||
from zerver.actions.user_settings import do_change_tos_version, do_change_user_setting
|
from zerver.actions.user_settings import do_change_tos_version, do_change_user_setting
|
||||||
@@ -156,6 +157,8 @@ def home(request: HttpRequest) -> HttpResponse:
|
|||||||
|
|
||||||
if subdomain == settings.SOCIAL_AUTH_SUBDOMAIN:
|
if subdomain == settings.SOCIAL_AUTH_SUBDOMAIN:
|
||||||
return redirect(settings.ROOT_DOMAIN_URI)
|
return redirect(settings.ROOT_DOMAIN_URI)
|
||||||
|
elif subdomain == settings.SELF_HOSTING_MANAGEMENT_SUBDOMAIN:
|
||||||
|
return redirect(reverse("remote_billing_legacy_server_login"))
|
||||||
realm = get_realm_from_request(request)
|
realm = get_realm_from_request(request)
|
||||||
if realm is None:
|
if realm is None:
|
||||||
return render(request, "zerver/invalid_realm.html", status=404)
|
return render(request, "zerver/invalid_realm.html", status=404)
|
||||||
|
|||||||
Reference in New Issue
Block a user