diff options
| author | Mattia Procopio <promat85@gmail.com> | 2018-03-14 10:36:22 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-03-15 21:42:47 -0400 |
| commit | 72667bc6ee00032385d3a3a500a8991ee3749f42 (patch) | |
| tree | aef5aa28075042600fda3f1e96b50b0d47cb881b /tests | |
| parent | 9bf8664bfd55c8b8586f94351f7e64cf258717b2 (diff) | |
[2.0.x] Fixed #29206 -- Fixed PasswordResetConfirmView crash when the URL contains a non-UUID where one is expected.
Backport of aeb8c381789ad93866223f8bd07d09ae5e2edd9e from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auth_tests/test_views.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py index 6549c64034..1beda4e487 100644 --- a/tests/auth_tests/test_views.py +++ b/tests/auth_tests/test_views.py @@ -30,6 +30,7 @@ from django.test.utils import patch_logger from django.urls import NoReverseMatch, reverse, reverse_lazy from django.utils.deprecation import RemovedInDjango21Warning from django.utils.encoding import force_text +from django.utils.http import urlsafe_base64_encode from django.utils.translation import LANGUAGE_SESSION_KEY from .client import PasswordResetConfirmClient @@ -439,6 +440,14 @@ class UUIDUserPasswordResetTest(CustomUserPasswordResetTest): ) return super()._test_confirm_start() + def test_confirm_invalid_uuid(self): + """A uidb64 that decodes to a non-UUID doesn't crash.""" + _, path = self._test_confirm_start() + invalid_uidb64 = urlsafe_base64_encode('INVALID_UUID'.encode()).decode() + first, _uuidb64_, second = path.strip('/').split('/') + response = self.client.get('/' + '/'.join((first, invalid_uidb64, second)) + '/') + self.assertContains(response, 'The password reset link was invalid') + class ChangePasswordTest(AuthViewsTestCase): |
