0001-PasswordChangeView-leave-user-on-form-page-in-case-o.patch
src/authentic2/views.py | ||
---|---|---|
1573 | 1573 |
try: |
1574 | 1574 |
response = super().form_valid(form) |
1575 | 1575 |
except utils_misc.PasswordChangeError as e: |
1576 |
messages.error(self.request, e.message)
|
|
1577 |
return utils_misc.redirect(self.request, self.post_change_redirect)
|
|
1576 |
form.add_error('new_password1', e.message)
|
|
1577 |
return self.form_invalid(form)
|
|
1578 | 1578 |
messages.info(self.request, _('Password changed')) |
1579 | 1579 |
self.request.journal.record('user.password.change', session=self.request.session) |
1580 | 1580 |
return response |
tests/test_ldap.py | ||
---|---|---|
1147 | 1147 |
with mock.patch( |
1148 | 1148 |
'authentic2.backends.ldap_backend.LDAPBackend.modify_password', side_effect=ldap.UNWILLING_TO_PERFORM |
1149 | 1149 |
): |
1150 |
response = response.form.submit().follow()
|
|
1150 |
response = response.form.submit() |
|
1151 | 1151 |
assert 'LDAP directory refused the password change' in response.text |
1152 | 1152 | |
1153 | 1153 |
tests/test_views.py | ||
---|---|---|
79 | 79 |
): |
80 | 80 |
resp = resp.form.submit() |
81 | 81 | |
82 |
resp = resp.follow() |
|
83 | 82 |
assert 'Password changed' not in resp |
84 | 83 |
assert 'boum!' in resp |
85 | 84 | |
86 |
- |