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 <galen.charlton@liblime.com>
This commit is contained in:
Owen Leonard 2008-10-01 12:39:17 -05:00 committed by Galen Charlton
parent 96c29c707f
commit 378e06dacb
2 changed files with 10 additions and 1 deletions

View File

@ -132,6 +132,9 @@
<!-- TMPL_IF NAME="ERROR_dateexpiry" -->
<li id="ERROR_dateexpiry">Date of expiration is invalid.</li>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="ERROR_short_password" -->
<li id="ERROR_short_password">Password must be at least <!-- TMPL_VAR NAME="minPasswordLength" --> characters long.</li>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="ERROR_extended_unique_id_failed" -->
<li id="ERROR_extended_unique_id_failed">The attribute value
<!-- TMPL_VAR NAME="ERROR_extended_unique_id_failed" --> is already is use by another patron record.</li>
@ -825,7 +828,7 @@
<!-- /TMPL_IF -->
<!--/TMPL_IF-->
<!--/TMPL_IF-->
<!-- TMPL_IF NAME="mandatorypassword" --><span class="required">Required</span><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="mandatorypassword" --><span class="required">Required</span><!-- /TMPL_IF --><div class="hint">Minimum password length: <!-- TMPL_VAR NAME="minPasswordLength" --></div>
</li></ol>
</fieldset>
<!--this zones are not necessary in modif mode -->

View File

@ -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);