Projet

Général

Profil

0001-misc-render-authenticators-names-in-their-own-templa.patch

Serghei Mihai (congés, retour 15/05), 16 novembre 2022 10:49

Télécharger (5,44 ko)

Voir les différences:

Subject: [PATCH] misc: render authenticators names in their own templates
 (#53264)

 .../authentic2/login_password_form.html       |  3 +++
 .../login_password_registration_form.html     | 20 ++++++++++++-------
 .../registration/registration_form.html       |  7 +------
 src/authentic2_auth_fc/models.py              |  2 +-
 .../templates/authentic2_auth_fc/login.html   |  7 ++++++-
 .../authentic2_auth_fc/registration.html      |  7 +++++++
 src/authentic2_auth_fc/views.py               |  7 ++++++-
 7 files changed, 37 insertions(+), 16 deletions(-)
 create mode 100644 src/authentic2_auth_fc/templates/authentic2_auth_fc/registration.html
src/authentic2/templates/authentic2/login_password_form.html
1 1
{% load i18n static gadjo %}
2 2

  
3
{% block login-block-title %}
4
{% endblock %}
5

  
3 6
{% block login %}
4 7

  
5 8
  {% block form %}
src/authentic2/templates/authentic2/login_password_registration_form.html
1 1
{% load i18n gadjo %}
2 2

  
3
{% block registration-block-title %}
4
  <h2>{% trans "Registration" %}</h2>
5
{% endblock %}
6

  
3 7
{% block registration %}
4
  <form enctype="multipart/form-data" method="post" class="pk-mark-optional-fields">
5
    {% csrf_token %}
6
    {{ form|with_template }}
7
    <div class="buttons">
8
      <button class="submit-button">{% trans 'Submit' %}</button>
9
    </div>
10
  </form>
8
  <p>
9
    <form enctype="multipart/form-data" method="post" class="pk-mark-optional-fields">
10
      {% csrf_token %}
11
      {{ form|with_template }}
12
      <div class="buttons">
13
        <button class="submit-button">{% trans 'Submit' %}</button>
14
      </div>
15
    </form>
16
  </p>
11 17
{% endblock %}
src/authentic2/templates/registration/registration_form.html
7 7

  
8 8
{% block content %}
9 9

  
10
  <h2>{{ view.title }}</h2>
11

  
12 10
  {% include "authentic2/service_info_fragment.html" %}
13 11

  
14 12
  {% for id, block in frontends.items %}
15 13
    <div class="registration_frontend">
16
      <h2>{{ block.name }}</h2>
17
      <p>
18
        {{ block.content|safe }}
19
      </p>
14
      {{ block.content|safe }}
20 15
    </div>
21 16
  {% endfor %}
22 17

  
src/authentic2_auth_fc/models.py
130 130
        return views.profile(request, *args, **kwargs)
131 131

  
132 132
    def registration(self, request, *args, **kwargs):
133
        return self.login(request, *args, **kwargs)
133
        return views.registration(request, *args, **kwargs)
134 134

  
135 135

  
136 136
class FcAccount(models.Model):
src/authentic2_auth_fc/templates/authentic2_auth_fc/login.html
1 1
{% load static %}
2 2
{% load i18n %}
3 3

  
4
{% block login %}
4
{% block title %}
5
  {% block login-block-title %}
6
  {% endblock %}
7
{% endblock %}
8

  
9
{% block content %}
5 10
  {% include "authentic2_auth_fc/explanation.html" %}
6 11
  <div id="fc-button-wrapper">
7 12
    <div id="fc-button">
src/authentic2_auth_fc/templates/authentic2_auth_fc/registration.html
1
{% extends "authentic2_auth_fc/login.html" %}
2

  
3
{% block title %}
4
  {% block registration-block-title %}
5
    <h2>FranceConnect</h2>
6
  {% endblock %}
7
{% endblock %}
src/authentic2_auth_fc/views.py
77 77
    )
78 78
    context['login_url'] = utils_misc.make_url('fc-login-or-link', keep_params=True, request=request)
79 79
    context['block-extra-css-class'] = 'fc-login'
80
    template = 'authentic2_auth_fc/login.html'
80
    template = kwargs.get('template', 'authentic2_auth_fc/login.html')
81 81
    return TemplateResponse(request, template, context)
82 82

  
83 83

  
84
def registration(request, *args, **kwargs):
85
    kwargs['template'] = 'authentic2_auth_fc/registration.html'
86
    return login(request, *args, **kwargs)
87

  
88

  
84 89
def profile(request, *args, **kwargs):
85 90
    # We prevent unlinking if the user has no usable password and can't change it
86 91
    # because we assume that the password is the unique other mean of authentication
87
-