diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py index 7370ca9c5f..9adc7fc979 100644 --- a/zerver/tests/test_auth_backends.py +++ b/zerver/tests/test_auth_backends.py @@ -1526,7 +1526,7 @@ class SocialAuthBase(DesktopFlowTestingLib, ZulipTestCase): result = self.client_get(result.url) self.assertEqual(result.status_code, 404) - self.assert_in_response("The registration link has expired or is not valid.", result) + self.assert_in_response("Whoops. The confirmation link is malformed.", result) @override_settings(TERMS_OF_SERVICE=None) def test_social_auth_registration_using_multiuse_invite(self) -> None: diff --git a/zerver/views/auth.py b/zerver/views/auth.py index aed7d0d8a2..f185348d3c 100644 --- a/zerver/views/auth.py +++ b/zerver/views/auth.py @@ -34,6 +34,7 @@ from confirmation.models import ( ConfirmationKeyException, create_confirmation_link, get_object_from_key, + render_confirmation_key_error, ) from version import API_FEATURE_LEVEL, ZULIP_MERGE_BASE, ZULIP_VERSION from zerver.context_processors import get_realm_from_request, login_context, zulip_default_context @@ -187,8 +188,8 @@ def maybe_send_to_registration( from_multiuse_invite = True try: multiuse_obj = get_object_from_key(multiuse_object_key, [Confirmation.MULTIUSE_INVITE]) - except ConfirmationKeyException: - return render(request, "zerver/confirmation_link_expired_error.html", status=404) + except ConfirmationKeyException as exception: + return render_confirmation_key_error(request, exception) assert multiuse_obj is not None realm = multiuse_obj.realm