mirror of https://github.com/zulip/zulip.git
auth: Improve Confirmation link error handling in social auth codepath.
render_confirmation_key_error provides better error responses than simply rendering the "link expired" template.
This commit is contained in:
parent
7c5daac8b6
commit
4a030f616f
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue