unsubscribe: Use a custom confirmation error page.

Reverts a bit of 6e02ce8.
This commit is contained in:
Rishi Gupta 2017-11-07 11:29:37 -08:00 committed by Tim Abbott
parent c2f1f54190
commit 1823d46236
2 changed files with 3 additions and 4 deletions

View File

@ -1107,10 +1107,9 @@ class EmailUnsubscribeTests(ZulipTestCase):
def test_error_unsubscribe(self): def test_error_unsubscribe(self):
# type: () -> None # type: () -> None
# An invalid insubscribe token "test123" produces an error, in this # An invalid unsubscribe token "test123" produces an error.
# case, a link malformed error.
result = self.client_get('/accounts/unsubscribe/missed_messages/test123') result = self.client_get('/accounts/unsubscribe/missed_messages/test123')
self.assert_in_response('Make sure you copied the link', result) self.assert_in_response('Unknown email unsubscribe request', result)
# An unknown message type "fake" produces an error. # An unknown message type "fake" produces an error.
user_profile = self.example_user('hamlet') user_profile = self.example_user('hamlet')

View File

@ -15,7 +15,7 @@ def process_unsubscribe(request: HttpRequest, confirmation_key: str, subscriptio
try: try:
user_profile = get_object_from_key(confirmation_key, Confirmation.UNSUBSCRIBE) user_profile = get_object_from_key(confirmation_key, Confirmation.UNSUBSCRIBE)
except ConfirmationKeyException as exception: except ConfirmationKeyException as exception:
return render_confirmation_key_error(request, exception) return render(request, 'zerver/unsubscribe_link_error.html')
unsubscribe_function(user_profile) unsubscribe_function(user_profile)
context = common_context(user_profile) context = common_context(user_profile)