From caea97367a044b8b80554710f0117ae7d54d6274 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 1 Oct 2008 12:39:17 -0500 Subject: [PATCH] Fix for Bug 2649, "minPasswordLength Sys Pref does nothing." Adds note specifying minimum password length to patron entry form, and generates warning if submitted password is not long enough. Signed-off-by: Galen Charlton --- .../prog/en/modules/members/memberentrygen.tmpl | 5 ++++- members/memberentry.pl | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl index 6d5a959619..bd05e6f42c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl @@ -132,6 +132,9 @@
  • Date of expiration is invalid.
  • + +
  • Password must be at least characters long.
  • +
  • The attribute value is already is use by another patron record.
  • @@ -825,7 +828,7 @@ - Required + Required
    Minimum password length:
    diff --git a/members/memberentry.pl b/members/memberentry.pl index dba1818c01..16fde6fe5d 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -84,6 +84,9 @@ my $userenv = C4::Context->userenv; $template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames')); +my $minpw = C4::Context->preference('minPasswordLength'); +$template->param("minPasswordLength" => $minpw); + # function to designate mandatory fields (visually with css) my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField"); my @field_check=split(/\|/,$check_BorrowerMandatoryField); @@ -212,6 +215,9 @@ if ($op eq 'save' || $op eq 'insert'){ push @errors, "ERROR_login_exist"; $loginexist=1; } + + my $password = $input->param('password'); + push @errors, "ERROR_short_password" if( $password && $minpw & (length($password) < $minpw ) ); if (C4::Context->preference('ExtendedPatronAttributes')) { $extended_patron_attributes = parse_extended_patron_attributes($input); -- 2.39.5