Fix for Bug 2649, "minPasswordLength Sys Pref does nothing." Adds note specifying...
authorOwen Leonard <oleonard@myacpl.org>
Wed, 1 Oct 2008 17:39:17 +0000 (12:39 -0500)
committerGalen Charlton <galen.charlton@liblime.com>
Mon, 6 Oct 2008 02:27:29 +0000 (21:27 -0500)
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
members/memberentry.pl

index 6d5a959..bd05e6f 100644 (file)
                        <!-- 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>
                                <!-- /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 -->
index dba1818..16fde6f 100755 (executable)
@@ -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);