Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

home: Redirect https://selfhosting.zuliphostname/ to /serverlogin/.

Alex Vandiverb10c61184090
diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py
index 73642c2987e..095e11d2d70 100644
--- a/zerver/tests/test_home.py
+++ b/zerver/tests/test_home.py
@@ -1092,6 +1092,11 @@ class HomeTest(ZulipTestCase):
self.assertEqual(result.status_code, 302)
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(
self,
content: str,
diff --git a/zerver/views/home.py b/zerver/views/home.py
index dfdc0ecf603..b9daec45cf1 100644
--- a/zerver/views/home.py
+++ b/zerver/views/home.py
@@ -5,6 +5,7 @@ from typing import List, Optional, Tuple
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import redirect, render
+from django.urls import reverse
from django.utils.cache import patch_cache_control
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:
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)
if realm is None:
return render(request, "zerver/invalid_realm.html", status=404)