auth_fc: restore button on registration page (#53241)

This commit is contained in:
Serghei Mihai 2021-04-19 11:03:35 +02:00
parent 87677f6d7e
commit 5ca05f327e
2 changed files with 18 additions and 0 deletions

View File

@ -79,3 +79,6 @@ class FcAuthenticator(BaseAuthenticator):
}
)
return render_to_string('authentic2_auth_fc/linking.html', context, request=request)
def registration(self, request, *args, **kwargs):
return self.login(request, *args, **kwargs)

View File

@ -535,3 +535,18 @@ def test_authorization_error(app, franceconnect):
messages = response.pyquery('.messages').text()
assert error in messages
assert error_description not in messages
def test_registration_page(settings, app, franceconnect, hooks):
assert User.objects.count() == 0
response = app.get('/accounts/register/?service=portail&next=/idp/')
response = franceconnect.login_with_fc_fixed_params(app)
# a new user has been created
assert User.objects.count() == 1
# we must be connected
assert app.session['_auth_user_id']
# hook must have been called
assert hooks.calls['event'][0]['kwargs']['name'] == 'fc-create'