Projet

Général

Profil

0001-views-pass-authentication_method-to-registration_suc.patch

Benjamin Dauvergne, 10 mai 2019 18:00

Télécharger (2,3 ko)

Voir les différences:

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(-)
src/authentic2/templates/authentic2/registration_success_body.html
1 1
{% load i18n %}
2 2
<html>
3
  <body style="max-width: 90ex">
3
  <body style="max-width: 90ex" data-authentication-method="{{ authentication_method }}">
4 4
    {% blocktrans with full_name=user.get_full_name %}
5 5
        <p> Hi {{ full_name }}!</p>
6 6
        <p>Your registration on {{ site }} was successful!</p>
src/authentic2/views.py
1082 1082
                                      'email': user.email,
1083 1083
                                      'site': self.request.get_host(),
1084 1084
                                      'login_url': login_url,
1085
                                      'authentication_method': self.authentication_method,
1085 1086
                                  },
1086 1087
                                  request=self.request)
1087 1088

  
tests/test_registration.py
64 64
    assert User.objects.count() == 1
65 65
    assert len(mailoutbox) == 2
66 66
    assert 'was successful' in mailoutbox[1].body
67
    assert 'data-authentication-method="email"' in mailoutbox[1].alternatives[0][0]
67 68

  
68 69
    new_user = User.objects.get()
69 70
    assert new_user.email == 'testbot@entrouvert.com'
70
-