#
# This file is part of the extensions and enhacments made to koha by Universidad ORT Uruguay
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use strict;
use warnings;
-use CGI;
+use CGI qw ( -utf8 );
use C4::Auth; # checkauth, getborrowernumber.
use C4::Context;
use C4::Circulation;
use C4::Members;
use C4::Output;
-use C4::Auth qw(hash_password);
+use Koha::AuthUtils qw(hash_password);
my $query = new CGI;
my $dbh = C4::Context->dbh;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
- template_name => "opac-passwd.tmpl",
+ template_name => "opac-passwd.tt",
query => $query,
type => "opac",
authnotrequired => 0,
- flagsrequired => { borrow => 1 },
debug => 1,
}
);
-# 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=?");
&& $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') );
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 ) = @_;