show change password link after user unlink (fixes #32953)
This commit is contained in:
parent
95d59c86d0
commit
11dccefc81
|
@ -90,9 +90,10 @@ class AppConfig(django.apps.AppConfig):
|
|||
return None
|
||||
|
||||
def a2_hook_user_can_change_password(self, user, request, **kwargs):
|
||||
for authentication_event in get_authentication_events(request=request):
|
||||
if authentication_event['how'] == 'france-connect':
|
||||
return False
|
||||
if 'fc_id_token' in request.session:
|
||||
for authentication_event in get_authentication_events(request=request):
|
||||
if authentication_event['how'] == 'france-connect':
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -575,3 +575,16 @@ def test_can_change_password(app, fc_settings, caplog, hooks):
|
|||
assert path(response['Location']) == '/accounts/'
|
||||
response = response.follow()
|
||||
assert len(response.pyquery('[href*="password/change"]')) == 0
|
||||
|
||||
# Unlink
|
||||
response = response.click('Delete link')
|
||||
response.form.set('new_password1', 'ikKL1234')
|
||||
response.form.set('new_password2', 'ikKL1234')
|
||||
response = response.form.submit(name='unlink')
|
||||
continue_url = response.pyquery('a#a2-continue').attr['href']
|
||||
state = urlparse.parse_qs(urlparse.urlparse(continue_url).query)['state'][0]
|
||||
assert app.session['fc_states'][state]['next'] == '/accounts/'
|
||||
response = app.get(reverse('fc-logout') + '?state=' + state)
|
||||
assert path(response['Location']) == '/accounts/'
|
||||
response = response.follow()
|
||||
assert len(response.pyquery('[href*="password/change"]')) > 0
|
||||
|
|
Loading…
Reference in New Issue