Bug 16635: t/00-load.t warning from C4/Barcodes/hbyymmincr.pm
[koha.git] / opac / opac-passwd.pl
index 2eaf6cc..4b33413 100755 (executable)
@@ -44,8 +44,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     }
 );
 
-# get borrower information ....
-my ( $borr ) = GetMemberDetails( $borrowernumber );
+my $borr = C4::Members::GetMember( borrowernumber => $borrowernumber );
 my $minpasslen = C4::Context->preference("minPasswordLength");
 if ( C4::Context->preference("OpacPasswordChange") ) {
     my $sth =  $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?");
@@ -54,7 +53,13 @@ if ( C4::Context->preference("OpacPasswordChange") ) {
         && $query->param('Confirm') )
     {
         if ( goodkey( $dbh, $borrowernumber, $query->param('Oldkey') ) ) {
-            if ( $query->param('Newkey') eq $query->param('Confirm')
+            if ( $query->param('Newkey') =~ m|^\s+| or $query->param('Newkey') =~ m|\s+$| ) {
+                $template->param(
+                    Error_messages => 1,
+                    PasswordContainsTrailingSpaces => 1,
+                );
+            }
+            elsif ( $query->param('Newkey') eq $query->param('Confirm')
                 && length( $query->param('Confirm') ) >= $minpasslen )
             {    # Record password
                 my $clave = hash_password( $query->param('Newkey') );
@@ -104,7 +109,7 @@ $template->param(firstname => $borr->{'firstname'},
                                                        passwdview => 1,
 );
 
-output_html_with_http_headers $query, $cookie, $template->output;
+output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
 
 sub goodkey {
     my ( $dbh, $borrowernumber, $key ) = @_;