Continuing fixing license and metadata
[koha.git] / opac / opac-passwd.pl
index 5684742..491cce0 100755 (executable)
@@ -19,7 +19,7 @@
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
-require Exporter;
+
 use CGI;
 
 use C4::Auth;    # checkauth, getborrowernumber.
@@ -44,7 +44,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
 );
 
 # get borrower information ....
-my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
+my ( $borr ) = GetMemberDetails( $borrowernumber );
 my $sth =  $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?");
 my $minpasslen = C4::Context->preference("minPasswordLength");
 if (   $query->param('Oldkey')
@@ -81,14 +81,25 @@ 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'},
                                                        surname => $borr->{'surname'},
                                                        minpasslen => $minpasslen,
+                                                       passwdview => 1,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;