From 00c9f45821567a34e4eabfbfe61fb2b1992abbd5 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 22 Apr 2018 14:41:13 -0700 Subject: [PATCH] auth: Remove dead invalid_subdomain code path. This code path has actually been dead for a while (since `invalid_subdomain` gets set to True only when `user_profile` is `None`). We might want to re-introduce it later, but for now, we eliminate it and the artificial test that provided it with test coverage. --- zerver/tests/test_auth_backends.py | 14 -------------- zerver/views/auth.py | 4 ---- 2 files changed, 18 deletions(-) diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py index d861f68a63..43d5dfed21 100644 --- a/zerver/tests/test_auth_backends.py +++ b/zerver/tests/test_auth_backends.py @@ -2260,20 +2260,6 @@ class LoginEmailValidatorTestCase(ZulipTestCase): with self.assertRaises(JsonableError): validate_login_email(u'hamlet') -class LoginOrRegisterRemoteUserTestCase(ZulipTestCase): - def test_invalid_subdomain(self) -> None: - full_name = 'Hamlet' - invalid_subdomain = True - user_profile = self.example_user('hamlet') - request = POSTRequestMock({}, user_profile) - response = login_or_register_remote_user( - request, - self.example_email('hamlet'), - user_profile, - full_name=full_name, - invalid_subdomain=invalid_subdomain) - self.assertIn('/accounts/login/?subdomain=1', response.url) - class LDAPBackendTest(ZulipTestCase): @override_settings(AUTHENTICATION_BACKENDS=('zproject.backends.ZulipLDAPAuthBackend',)) def test_non_existing_realm(self) -> None: diff --git a/zerver/views/auth.py b/zerver/views/auth.py index 736c291ffe..5dde7d14a5 100644 --- a/zerver/views/auth.py +++ b/zerver/views/auth.py @@ -153,10 +153,6 @@ def login_or_register_remote_user(request: HttpRequest, remote_username: Optiona 'zerver/confirm_continue_registration.html', context=context) - if invalid_subdomain: - # Show login page with an error message - return redirect_to_subdomain_login_url() - if mobile_flow_otp is not None: # For the mobile Oauth flow, we send the API key and other # necessary details in a redirect to a zulip:// URI scheme.