Bug 18298: (QA followup) Use Koha.Preference on the template
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
3f9da34683
commit
9136c3dbf8
|
|
@ -9,7 +9,7 @@
|
|||
function generate_password() {
|
||||
// Always generate a strong password
|
||||
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
var length = [% minPasswordLength %];
|
||||
var length = [% Koha.Preference('minPasswordLength') %];
|
||||
if ( length < 8 ) length = 8;
|
||||
var password='';
|
||||
for ( var i = 0 ; i < length ; i++){
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
$("body").on('click', "#fillrandom",function(e) {
|
||||
e.preventDefault();
|
||||
var password = '';
|
||||
var pattern_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{[% minPasswordLength %],}/;
|
||||
var pattern_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{[% Koha.Preference('minPasswordLength') %],}/;
|
||||
while ( ! pattern_regex.test( password ) ) {
|
||||
password = generate_password();
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
<li>You have entered a username that already exists. Please choose another one.</li>
|
||||
[% END %]
|
||||
[% IF ( ERROR_password_too_short ) %]
|
||||
<li id="ERROR_short_password">Password must be at least [% minPasswordLength %] characters long.</li>
|
||||
<li id="ERROR_short_password">Password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</li>
|
||||
[% END %]
|
||||
[% IF ( ERROR_password_too_weak ) %]
|
||||
<li id="ERROR_weak_password">Password must contain at least one digit, one lowercase and one uppercase.</li>
|
||||
|
|
@ -117,9 +117,9 @@
|
|||
<ol>
|
||||
<li><label for="newuserid">New username:</label>
|
||||
<input type="hidden" name="member" value="[% borrowernumber %]" /><input type="text" id="newuserid" name="newuserid" size="20" value="[% userid %]" /></li>
|
||||
[% SET password_pattern = ".{" _ minPasswordLength _ ",}" %]
|
||||
[% SET password_pattern = ".{" _ Koha.Preference('minPasswordLength') _ ",}" %]
|
||||
[% IF Koha.Preference('RequireStrongPassword') %]
|
||||
[% SET password_pattern = '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{' _ minPasswordLength _ ',}' %]
|
||||
[% SET password_pattern = '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{' _ Koha.Preference('minPasswordLength') _ ',}' %]
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="newpassword">New password:</label>
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ $template->param(
|
|||
userid => $bor->{'userid'},
|
||||
destination => $destination,
|
||||
is_child => ( $category_type eq 'C' ),
|
||||
minPasswordLength => $minpw,
|
||||
RoutingSerials => C4::Context->preference('RoutingSerials'),
|
||||
csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID'), }),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue