Lines 9-15
Link Here
|
9 |
function generate_password() { |
9 |
function generate_password() { |
10 |
// Always generate a strong password |
10 |
// Always generate a strong password |
11 |
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
11 |
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
12 |
var length = [% minPasswordLength %]; |
12 |
var length = [% Koha.Preference('minPasswordLength') %]; |
13 |
if ( length < 8 ) length = 8; |
13 |
if ( length < 8 ) length = 8; |
14 |
var password=''; |
14 |
var password=''; |
15 |
for ( var i = 0 ; i < length ; i++){ |
15 |
for ( var i = 0 ; i < length ; i++){ |
Lines 21-27
Link Here
|
21 |
$("body").on('click', "#fillrandom",function(e) { |
21 |
$("body").on('click', "#fillrandom",function(e) { |
22 |
e.preventDefault(); |
22 |
e.preventDefault(); |
23 |
var password = ''; |
23 |
var password = ''; |
24 |
var pattern_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{[% minPasswordLength %],}/; |
24 |
var pattern_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{[% Koha.Preference('minPasswordLength') %],}/; |
25 |
while ( ! pattern_regex.test( password ) ) { |
25 |
while ( ! pattern_regex.test( password ) ) { |
26 |
password = generate_password(); |
26 |
password = generate_password(); |
27 |
} |
27 |
} |
Lines 94-100
Link Here
|
94 |
<li>You have entered a username that already exists. Please choose another one.</li> |
94 |
<li>You have entered a username that already exists. Please choose another one.</li> |
95 |
[% END %] |
95 |
[% END %] |
96 |
[% IF ( ERROR_password_too_short ) %] |
96 |
[% IF ( ERROR_password_too_short ) %] |
97 |
<li id="ERROR_short_password">Password must be at least [% minPasswordLength %] characters long.</li> |
97 |
<li id="ERROR_short_password">Password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</li> |
98 |
[% END %] |
98 |
[% END %] |
99 |
[% IF ( ERROR_password_too_weak ) %] |
99 |
[% IF ( ERROR_password_too_weak ) %] |
100 |
<li id="ERROR_weak_password">Password must contain at least one digit, one lowercase and one uppercase.</li> |
100 |
<li id="ERROR_weak_password">Password must contain at least one digit, one lowercase and one uppercase.</li> |
Lines 117-125
Link Here
|
117 |
<ol> |
117 |
<ol> |
118 |
<li><label for="newuserid">New username:</label> |
118 |
<li><label for="newuserid">New username:</label> |
119 |
<input type="hidden" name="member" value="[% borrowernumber %]" /><input type="text" id="newuserid" name="newuserid" size="20" value="[% userid %]" /></li> |
119 |
<input type="hidden" name="member" value="[% borrowernumber %]" /><input type="text" id="newuserid" name="newuserid" size="20" value="[% userid %]" /></li> |
120 |
[% SET password_pattern = ".{" _ minPasswordLength _ ",}" %] |
120 |
[% SET password_pattern = ".{" _ Koha.Preference('minPasswordLength') _ ",}" %] |
121 |
[% IF Koha.Preference('RequireStrongPassword') %] |
121 |
[% IF Koha.Preference('RequireStrongPassword') %] |
122 |
[% SET password_pattern = '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{' _ minPasswordLength _ ',}' %] |
122 |
[% SET password_pattern = '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{' _ Koha.Preference('minPasswordLength') _ ',}' %] |
123 |
[% END %] |
123 |
[% END %] |
124 |
<li> |
124 |
<li> |
125 |
<label for="newpassword">New password:</label> |
125 |
<label for="newpassword">New password:</label> |