|
@@ -304,6 +304,16 @@ class PasswordResetTest(AuthViewsTestCase):
|
|
|
response = self.client.post(path, {'new_password1': 'anewpassword', 'new_password2': 'anewpassword'})
|
|
|
self.assertRedirects(response, '/password_reset/', fetch_redirect_response=False)
|
|
|
|
|
|
+ def test_confirm_custom_reset_url_token(self):
|
|
|
+ url, path = self._test_confirm_start()
|
|
|
+ path = path.replace('/reset/', '/reset/custom/token/')
|
|
|
+ self.client.reset_url_token = 'set-passwordcustom'
|
|
|
+ response = self.client.post(
|
|
|
+ path,
|
|
|
+ {'new_password1': 'anewpassword', 'new_password2': 'anewpassword'},
|
|
|
+ )
|
|
|
+ self.assertRedirects(response, '/reset/done/', fetch_redirect_response=False)
|
|
|
+
|
|
|
def test_confirm_login_post_reset(self):
|
|
|
url, path = self._test_confirm_start()
|
|
|
path = path.replace('/reset/', '/reset/post_reset_login/')
|
|
@@ -360,6 +370,16 @@ class PasswordResetTest(AuthViewsTestCase):
|
|
|
self.assertRedirects(response, '/reset/%s/set-password/' % uuidb64)
|
|
|
self.assertEqual(client.session['_password_reset_token'], token)
|
|
|
|
|
|
+ def test_confirm_custom_reset_url_token_link_redirects_to_set_password_page(self):
|
|
|
+ url, path = self._test_confirm_start()
|
|
|
+ path = path.replace('/reset/', '/reset/custom/token/')
|
|
|
+ client = Client()
|
|
|
+ response = client.get(path)
|
|
|
+ token = response.resolver_match.kwargs['token']
|
|
|
+ uuidb64 = response.resolver_match.kwargs['uidb64']
|
|
|
+ self.assertRedirects(response, '/reset/custom/token/%s/set-passwordcustom/' % uuidb64)
|
|
|
+ self.assertEqual(client.session['_password_reset_token'], token)
|
|
|
+
|
|
|
def test_invalid_link_if_going_directly_to_the_final_reset_password_url(self):
|
|
|
url, path = self._test_confirm_start()
|
|
|
_, uuidb64, _ = path.strip('/').split('/')
|