Lines 6-19
Link Here
|
6 |
<script type="text/JavaScript"> |
6 |
<script type="text/JavaScript"> |
7 |
//<![CDATA[ |
7 |
//<![CDATA[ |
8 |
|
8 |
|
|
|
9 |
function generate_password() { |
10 |
// Always generate a strong password |
11 |
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
12 |
var length = [% minPasswordLength %]; |
13 |
var password=''; |
14 |
for ( var i = 0 ; i < length ; i++){ |
15 |
password += chars.charAt(Math.floor(Math.random()*chars.length)); |
16 |
} |
17 |
return password; |
18 |
} |
9 |
$(document).ready(function() { |
19 |
$(document).ready(function() { |
10 |
$("body").on('click', "#fillrandom",function(e) { |
20 |
$("body").on('click', "#fillrandom",function(e) { |
11 |
e.preventDefault(); |
21 |
e.preventDefault(); |
12 |
$.get("/cgi-bin/koha/members/member-password.pl?member=[% userid %]", function(response) { |
22 |
var password = ''; |
13 |
var defaultnewpass = $(response).find("#defaultnewpassfield").val(); |
23 |
var pattern_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{[% minPasswordLength %],}/; |
14 |
$("#newpassword").after("<input type=\"text\" name=\"newpassword\" id=\"newpassword\" value=\"" + defaultnewpass + "\">").remove(); |
24 |
while ( ! pattern_regex.test( password ) ) { |
15 |
$("#newpassword2").after("<input type=\"text\" name=\"newpassword2\" id=\"newpassword2\" value=\"" + defaultnewpass + "\">").remove(); |
25 |
password = generate_password(); |
16 |
}); |
26 |
} |
|
|
27 |
$("#newpassword").val(password); |
28 |
$("#newpassword").attr('type', 'text'); |
29 |
$("#newpassword2").val(password); |
30 |
$("#newpassword2").attr('type', 'text'); |
17 |
}); |
31 |
}); |
18 |
$("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>"); |
32 |
$("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>"); |
19 |
|
33 |
|
Lines 120-126
Link Here
|
120 |
|
134 |
|
121 |
</div> |
135 |
</div> |
122 |
</div> |
136 |
</div> |
123 |
<input type="hidden" name="defaultnewpassfield" id="defaultnewpassfield" value="[% defaultnewpassword %]" /> |
|
|
124 |
<div class="loading hide"><strong>Processing...</strong><img src="[% interface %]/[% theme %]/img/loading.gif" alt="" /></div> |
137 |
<div class="loading hide"><strong>Processing...</strong><img src="[% interface %]/[% theme %]/img/loading.gif" alt="" /></div> |
125 |
<div class="yui-b"> |
138 |
<div class="yui-b"> |
126 |
[% INCLUDE 'circ-menu.inc' %] |
139 |
[% INCLUDE 'circ-menu.inc' %] |