Projet

Général

Profil

0003-use-new-password-widget-in-manager-25045.patch

Benjamin Dauvergne, 02 août 2018 17:02

Télécharger (3,01 ko)

Voir les différences:

Subject: [PATCH 3/4] use new password widget in manager (#25045)

 src/authentic2/manager/forms.py                      |  8 +++-----
 .../manager/templates/authentic2/manager/form.html   | 12 +++++++++++-
 src/authentic2/manager/views.py                      |  1 +
 3 files changed, 15 insertions(+), 6 deletions(-)
src/authentic2/manager/forms.py
12 12
from authentic2.compat import get_user_model
13 13
from authentic2.passwords import generate_password
14 14
from authentic2.utils import send_templated_mail
15
from authentic2.forms.fields import NewPasswordField, CheckPasswordField
15 16

  
16 17
from django_rbac.models import Operation
17 18
from django_rbac.utils import get_ou_model, get_role_model, get_permission_model
......
288 289
        initial=False,
289 290
        label=_('Generate new password'),
290 291
        required=False)
291
    password1 = forms.CharField(
292
    password1 = NewPasswordField(
292 293
        label=_("Password"),
293
        widget=forms.PasswordInput,
294 294
        required=False)
295
    password2 = forms.CharField(
295
    password2 = CheckPasswordField(
296 296
        label=_("Confirmation"),
297
        widget=forms.PasswordInput,
298
        help_text=_("Enter the same password as above, for verification."),
299 297
        required=False)
300 298
    send_mail = forms.BooleanField(
301 299
        initial=True,
src/authentic2/manager/templates/authentic2/manager/form.html
7 7
  {% endif %}
8 8
{% endblock %}
9 9

  
10
{% block css %}
11
{{ block.super }}
12
{{ form.media.css }}
13
{% endblock %}
14

  
15
{% block js %}
16
{{ block.super }}
17
{{ form.media.js }}
18
{% endblock %}
19

  
10 20
{% block content %}
11 21
  <form 
12 22
    {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}
......
44 54
          {{ field.label_tag }}
45 55
          {{ field }}
46 56
          {% if field.help_text %}
47
            <span class="helptext">{{ field.help_text }}</span>
57
            <span class="helptext">{{ field.help_text|safe }}</span>
48 58
          {% endif %}
49 59
          {% if field.errors %}
50 60
            <ul class="errorlist">
src/authentic2/manager/views.py
63 63
        css = {
64 64
            'all': (
65 65
                'authentic2/manager/css/style.css',
66
                'authentic2/css/password.css',
66 67
            )
67 68
        }
68 69

  
69
-