1 | <!-- $Id$ --> |
---|
2 | [% INCLUDE 'users/object_header.tt' %] |
---|
3 | |
---|
4 | <script type="text/javascript"> |
---|
5 | function check_passwd(fullcheck) { |
---|
6 | if ($("#passwd").val()) { |
---|
7 | if ($("#passwd").val() == $("#cpasswd").val() || fullcheck) { |
---|
8 | $.ajax({ |
---|
9 | url: '[% c.uri_for('/ajax', 'cracklib', username) %]', |
---|
10 | data: { passwd: $("#passwd").val(), cpasswd: $("#cpasswd").val() }, |
---|
11 | }).done(function(msg) { |
---|
12 | $('#perror').html(msg); |
---|
13 | }); |
---|
14 | } else { |
---|
15 | $('#perror').html('[% l('Password are different') %]'); |
---|
16 | } |
---|
17 | } else { |
---|
18 | $('#perror').html('[% l('Please enter password') %]'); |
---|
19 | } |
---|
20 | } |
---|
21 | |
---|
22 | $(function () { |
---|
23 | |
---|
24 | $("#passwd").on( 'keyup', function() { check_passwd(1) }); |
---|
25 | $("#cpasswd").on('keyup', function() { check_passwd(0) }); |
---|
26 | |
---|
27 | }); |
---|
28 | </script> |
---|
29 | |
---|
30 | <div id="objectform" class="objectform"> |
---|
31 | <h2> |
---|
32 | [%- IF c.user.username != username -%]Changer le mot de passe de [% username -%] |
---|
33 | [%- ELSE -%]Changer mon mot de passe |
---|
34 | [%- END -%]: |
---|
35 | </h2> |
---|
36 | |
---|
37 | |
---|
38 | [% lastset = user.get_attributes('passwordLastSet') %] |
---|
39 | [% IF lastset %] |
---|
40 | <p>Le mot de passe a été changé la derniÚre fois le [% lastset | html %](GMT)</p> |
---|
41 | [% ELSE %] |
---|
42 | <p>Aucun mot de passe n'a été mis pour ce compte</p> |
---|
43 | [% END %] |
---|
44 | |
---|
45 | [% IF c.model('Accounts').db.check_acl(user, 'userPassword', 'w') %] |
---|
46 | |
---|
47 | <form id="fpasswd" action="[% c.uri_for(username, subform) %]" method="POST"> |
---|
48 | <table border="1"> |
---|
49 | <tr> |
---|
50 | <th>Nouveau mot de passe:</th> |
---|
51 | <td><input type="password" name="passwd" id="passwd"></td> |
---|
52 | </tr> |
---|
53 | <tr> |
---|
54 | <th>Confirmation:</th> |
---|
55 | <td><input type="password" name="cpasswd" id="cpasswd"></td> |
---|
56 | </tr> |
---|
57 | <tr><td colspan="2"><span id="perror">[% pmerror | html %]</span></td></tr> |
---|
58 | </table> |
---|
59 | </form> |
---|
60 | |
---|
61 | <p>Pas d'idée ?</p> |
---|
62 | <p>Cliquez que générer pour obtenir un mot aléatoire. Il doit être taper et non |
---|
63 | copier/coller. Pensez à le noter.</p> |
---|
64 | |
---|
65 | <form id="fgenpasswd"> |
---|
66 | <input type=submit value="Générer !"> |
---|
67 | <span id="randpasswd">----</span> |
---|
68 | <ul id="randpasswd_options"> |
---|
69 | <li><input type=checkbox name=nonalpha value="1">Utiliser des caractÚres non |
---|
70 | alpha-numérique</li> |
---|
71 | <li><input type=checkbox name=syllables value="1">Utiliser des syllabes plutÃŽt que |
---|
72 | des lettres</li> |
---|
73 | </ul> |
---|
74 | </form> |
---|
75 | <script> |
---|
76 | $(function() { |
---|
77 | $('#fgenpasswd').submit(function() { |
---|
78 | $.ajax({ |
---|
79 | url: '[% c.uri_for('/ajax', 'random_password') %]', |
---|
80 | data: $('#fgenpasswd').serialize(), |
---|
81 | }).done(function(msg) { |
---|
82 | $('#randpasswd').html(msg); |
---|
83 | }); |
---|
84 | return false; |
---|
85 | }); |
---|
86 | }); |
---|
87 | </script> |
---|
88 | |
---|
89 | [% ELSE %] |
---|
90 | <p>Vous n'avez pas les droits suffisants pour changer ce mot de passe</p> |
---|
91 | [% END %] |
---|
92 | </div> |
---|