From 181d9c7d72ec5ff09c7976af7285f166581eebbb Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 10 May 2019 17:58:43 +0200 Subject: [PATCH] views: pass authentication_method to registration_success template (#33006) --- .../templates/authentic2/registration_success_body.html | 2 +- src/authentic2/views.py | 1 + tests/test_registration.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/authentic2/templates/authentic2/registration_success_body.html b/src/authentic2/templates/authentic2/registration_success_body.html index fe3a3349..a58d3dc3 100644 --- a/src/authentic2/templates/authentic2/registration_success_body.html +++ b/src/authentic2/templates/authentic2/registration_success_body.html @@ -1,6 +1,6 @@ {% load i18n %} - + {% blocktrans with full_name=user.get_full_name %}

Hi {{ full_name }}!

Your registration on {{ site }} was successful!

diff --git a/src/authentic2/views.py b/src/authentic2/views.py index 8d52b40d..ccecfd5e 100644 --- a/src/authentic2/views.py +++ b/src/authentic2/views.py @@ -1082,6 +1082,7 @@ class RegistrationCompletionView(CreateView): 'email': user.email, 'site': self.request.get_host(), 'login_url': login_url, + 'authentication_method': self.authentication_method, }, request=self.request) diff --git a/tests/test_registration.py b/tests/test_registration.py index c4693206..0beb2e79 100644 --- a/tests/test_registration.py +++ b/tests/test_registration.py @@ -64,6 +64,7 @@ def test_registration(app, db, settings, mailoutbox, external_redirect): assert User.objects.count() == 1 assert len(mailoutbox) == 2 assert 'was successful' in mailoutbox[1].body + assert 'data-authentication-method="email"' in mailoutbox[1].alternatives[0][0] new_user = User.objects.get() assert new_user.email == 'testbot@entrouvert.com' -- 2.20.1