views: keep next_url on password reset (#69537)
It was already working in the regular case, but not if no account matches the given email.
This commit is contained in:
parent
537d2e3e6a
commit
0db08a6feb
|
@ -127,7 +127,12 @@ class PasswordResetForm(HoneypotForm):
|
|||
logger.info('password reset request for "%s", no user found', email)
|
||||
if getattr(settings, 'REGISTRATION_OPEN', True):
|
||||
ctx = {
|
||||
'registration_url': utils_misc.make_url('registration_register', absolute=True),
|
||||
'registration_url': utils_misc.make_url(
|
||||
'registration_register',
|
||||
absolute=True,
|
||||
next_url=self.cleaned_data.get('next_url'),
|
||||
sign_next_url=True,
|
||||
),
|
||||
}
|
||||
else:
|
||||
ctx = {}
|
||||
|
|
|
@ -167,8 +167,7 @@ def test_old_url_redirect(app):
|
|||
)
|
||||
def test_send_password_reset_email_no_account(app, db, mailoutbox, settings, registration_open):
|
||||
settings.REGISTRATION_OPEN = registration_open
|
||||
url = reverse('password_reset')
|
||||
resp = app.get(url, status=200)
|
||||
resp = app.get('/password/reset/?next=/whatever/', status=200)
|
||||
resp.form.set('email', 'test@entrouvert.com')
|
||||
resp = resp.form.submit()
|
||||
|
||||
|
@ -178,6 +177,8 @@ def test_send_password_reset_email_no_account(app, db, mailoutbox, settings, reg
|
|||
assert 'no account was found associated with this address' in body
|
||||
if settings.REGISTRATION_OPEN:
|
||||
assert 'http://testserver/register/' in body
|
||||
# check next_url was preserved
|
||||
assert 'next=/whatever/' in body
|
||||
else:
|
||||
assert 'http://testserver/register/' not in body
|
||||
|
||||
|
|
Loading…
Reference in New Issue