Bug 19514: Add client-side check

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2017-11-06 12:22:59 -03:00 committed by Nick Clemens
parent b59a2c4d11
commit d5fde992ef
3 changed files with 25 additions and 0 deletions

View File

@ -149,6 +149,10 @@ sub get_template_and_user {
$template->param( CAN_user_serials => 1 );
$template->param( CAN_user_reports => 1 );
}
my $minPasswordLength = C4::Context->preference('minPasswordLength');
$minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3;
$template->param(minPasswordLength => $minPasswordLength,);
}
return ( $template, $borrowernumber, $cookie );
}

View File

@ -1,3 +1,4 @@
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Web installer &rsaquo; Create Koha administrator patron</title>
[% INCLUDE 'installer-doc-head-close.inc' %]
@ -112,3 +113,5 @@
</div> <!-- / .row -->
[% INCLUDE 'intranet-bottom.inc' %]
[% PROCESS 'password_check.inc' %]
[% PROCESS 'add_password_check' new_password => 'password' %]

View File

@ -1,5 +1,17 @@
function _(s) { return s; } // dummy function for gettext
// http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery/5341855#5341855
String.prototype.format = function() { return formatstr(this, arguments); };
function formatstr(str, col) {
col = typeof col === 'object' ? col : Array.prototype.slice.call(arguments, 1);
var idx = 0;
return str.replace(/%%|%s|%(\d+)\$s/g, function (m, n) {
if (m == "%%") { return "%"; }
if (m == "%s") { return col[idx++]; }
return col[n];
});
}
jQuery.validator.addMethod( "category_code_check", function(value,element){
var patt = /^[A-Za-z0-9]{0,10}$/g;
if (patt.test(element.value)) {
@ -114,6 +126,12 @@ $(document).ready(function() {
required: true
},
password: {
required: true,
password_strong: true,
password_no_spaces: true
},
password2: {
required: true,
password_match: true
}
},