Fix for bug 1334 better error messages if one or 2 fields are left blank
authorChris Cormack <crc@liblime.com>
Mon, 7 Jan 2008 23:55:32 +0000 (17:55 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 8 Jan 2008 02:02:59 +0000 (20:02 -0600)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tmpl
opac/opac-passwd.pl

index b3153a1..93997ff 100644 (file)
@@ -28,7 +28,7 @@
     
     <!-- TMPL_IF NAME= "Ask_data" -->
         <!-- TMPL_IF NAME="OpacPasswordChange" -->
-        <form action="/cgi-bin/koha/opac-passwd.pl" name="mainform" id="mainform" method="get"><fieldset class="rows">
+        <form action="/cgi-bin/koha/opac-passwd.pl" name="mainform" id="mainform" method="post"><fieldset class="rows">
                        <!-- TMPL_UNLESS NAME= "ShortPass" --><div class="hint">Your password must be at least <!-- TMPL_VAR NAME="minpasslen" --> characters long.</div><!-- /TMPL_UNLESS -->
           <ol>  <li><label for="password">Current Password:</label> <input type="password" id="Oldkey" size="25"  name="Oldkey" /></li>
             <li><label for="Newkey">New Password:</label> <input type="password" id="Newkey"  size="25"  name="Newkey" /></li>
index 5684742..860f62a 100755 (executable)
@@ -81,9 +81,19 @@ if (   $query->param('Oldkey')
     }
 }
 else {
-
+   
     # Called Empty, Ask for data.
     $template->param( 'Ask_data' => '1' );
+       if (!$query->param('Oldkey') && ($query->param('Newkey') || $query->param('Confirm'))){
+               # Old password is empty but one of the others isnt
+               $template->param( 'Error_messages' => '1' );
+               $template->param( 'WrongPass'      => '1' );
+       }
+       elsif ($query->param('Oldkey') && (!$query->param('Newkey') || !$query->param('Confirm'))){
+               # Oldpassword is entered but one of the other fields is empty
+               $template->param( 'Error_messages' => '1' );
+               $template->param( 'PassMismatch'   => '1' );
+       }
 }
 
 $template->param(firstname => $borr->{'firstname'},