6 [% INCLUDE 'doc-head-open.inc' %]
8 [% IF ( newpassword ) %]Password updated [% ELSE %]Update password for [% patron.surname | html %], [% patron.firstname | html %][% END %] › Patrons › Koha
10 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="pat_member-password" class="pat">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'patron-search.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
26 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>
29 <a href="#" aria-current="page">
30 [% IF ( newpassword ) %]
33 Change username and/or password
40 <div class="main container-fluid">
42 <div class="col-sm-10 col-sm-push-2">
45 [% INCLUDE 'members-toolbar.inc' %]
47 [% IF ( newpassword ) %]
48 <h1>Password updated</h1>
52 <form method="post" id="changepasswordf" action="/cgi-bin/koha/members/member-password.pl">
53 <input type="hidden" name="destination" value="[% destination | html %]" />
54 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
56 <div class="dialog alert">
57 <h4>The following errors have occurred:</h4>
59 [% IF ( BADUSERID ) %]
60 <li>You have entered a username that already exists. Please choose another one.</li>
62 [% IF ( ERROR_password_too_short ) %]
63 <li id="ERROR_short_password">Password must be at least [% patron.category.effective_min_password_length | html %] characters long.</li>
65 [% IF ( ERROR_password_too_weak ) %]
66 <li id="ERROR_weak_password">Password must contain at least one digit, one lowercase and one uppercase.</li>
68 [% IF ( ERROR_password_has_whitespaces ) %]
69 <li id="ERROR_weak_password">Password must not contain leading or trailing whitespaces.</li>
71 [% IF ( ERROR_from_plugin ) %]
72 <li id="ERROR_from_plugin">The password was rejected by a plugin.</li>
74 [% IF ( NOPERMISSION ) %]
75 <li>You do not have permission to edit this patron's login information.</li>
78 <li><strong>The passwords entered do not match</strong>. Please re-enter the new password.</li>
85 <fieldset class="brief"><legend>Change username and/or password for [% patron.firstname | html %] [% patron.surname | html %]</legend>
87 <li><label for="newuserid">New username:</label>
88 <input type="hidden" name="member" value="[% patron.borrowernumber | html %]" /><input type="text" id="newuserid" name="newuserid" size="20" value="[% patron.userid | html %]" /></li>
89 [% SET password_pattern = ".{" _ patron.category.effective_min_password_length _ ",}" %]
90 [% IF patron.category.effective_require_strong_password %]
91 [% SET password_pattern = '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{' _ patron.category.effective_min_password_length _ ',}' %]
94 <label for="newpassword">New password:</label>
95 <div class="hint">Koha cannot display existing passwords. Leave the field blank to leave password unchanged.</div>
96 <input name="newpassword" id="newpassword" type="password" size="20" />
99 <label for="newpassword2">Confirm new password:</label>
100 <input name="newpassword2" id="newpassword2" type="password" size="20" />
104 <fieldset class="action">
105 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
106 <input type="submit" value="Save" />
107 <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
112 <div class="loading hide"><strong>Processing...</strong><img src="[% interface | html %]/[% theme | html %]/img/loading.gif" alt="" /></div>
115 </div> <!-- /.col-sm-10.col-sm-push-2 -->
117 <div class="col-sm-2 col-sm-pull-10">
119 [% INCLUDE 'circ-menu.inc' %]
121 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
122 </div> <!-- /.row -->
124 [% MACRO jsinclude BLOCK %]
125 [% INCLUDE 'str/members-menu.inc' %]
126 [% Asset.js("js/members-menu.js") | $raw %]
128 function generate_password() {
129 // Always generate a strong password
130 var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
131 var length = [% patron.category.effective_min_password_length | html %];
132 if ( length < 8 ) length = 8;
134 for ( var i = 0 ; i < length ; i++){
135 password += chars.charAt(Math.floor(Math.random()*chars.length));
139 $(document).ready(function() {
140 $("body").on('click', "#fillrandom",function(e) {
143 var pattern_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{[% patron.category.effective_min_password_length | html %],}/;
144 while ( ! pattern_regex.test( password ) ) {
145 password = generate_password();
147 $("#newpassword").val(password);
148 $("#newpassword").attr('type', 'text');
149 $("#newpassword2").val(password);
150 $("#newpassword2").attr('type', 'text');
152 $("div.hint").eq(0).after(" <div class=\"hint\"><a href=\"#\" id=\"fillrandom\">"+_("Click to fill with a randomly generated suggestion. ")+"<strong>"+_("Passwords will be displayed as text")+"</strong>.</a></div>");
154 $(document).ajaxStart(function () {
155 $("input[name^=newpassword]").hide();
156 $("label[for=newpassword2]").hide();
157 $(".hint:last").after($(".loading").show());
159 $(document).ajaxStop(function () {
160 $("input[name^=newpassword]").show();
161 $("label[for=newpassword2]").show();
162 $(".loading").hide();
163 $("label.error").hide();
166 $("#newpassword").addClass('focus');
169 $("#changepasswordf").validate({
172 password_strong: true,
173 password_no_spaces: true
182 [% PROCESS 'password_check.inc' new_password => 'newpassword', minPasswordLength => patron.category.effective_min_password_length, RequireStrongPassword => patron.category.effective_require_strong_password %]
185 [% INCLUDE 'intranet-bottom.inc' %]