From 1e78daf9abe64316b2ac0c256a7ab284b9bbca20 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 4 Dec 2007 15:00:10 -0600 Subject: [PATCH] Changes to fix Bug 1335 (Min password length is hardcoded in template error message). Script now checks for passes to the template the value of minPasswordLength system preference so the user knows beforehand what the requirements are, and so that the error message can contain the correct value. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 6 +++--- .../opac-tmpl/prog/en/modules/opac-passwd.tmpl | 15 ++++++++------- opac/opac-passwd.pl | 17 +++++++++++------ 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 0bd9a2f6cd..01eef3ba80 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -606,9 +606,9 @@ fieldset.brief ol, fieldset.brief li { } fieldset.brief div.hint, fieldset.rows div.hint { - color : #999999; - font-size : 95%; - margin-bottom : .4em; + color : #666666; + font-size : 100%; + margin : .4em; } #menu { diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tmpl index 096bf39d8a..b3153a15eb 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tmpl @@ -1,4 +1,4 @@ -Koha Online Catalog › Account for +Koha Online Catalog › Account for @@ -8,27 +8,28 @@
+ +

's account l../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Change your Password

-

There was a problem with your submission

-

+

There was a problem with your submission

+

Passwords do not match. Please re-type your new password. - Your new password must be at least 6 characters long + Your new password must be at least characters long Your current password was entered incorrectly. If this problem persists, please ask a librarian to re-set your password for you. -

+

-

's account l../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Change your Password

-
+
Your password must be at least characters long.
diff --git a/opac/opac-passwd.pl b/opac/opac-passwd.pl index c0e6c2444a..5684742a91 100755 --- a/opac/opac-passwd.pl +++ b/opac/opac-passwd.pl @@ -26,7 +26,7 @@ use C4::Auth; # checkauth, getborrowernumber. use C4::Context; use Digest::MD5 qw(md5_base64); use C4::Circulation; - +use C4::Members; use C4::Output; my $query = new CGI; @@ -44,16 +44,16 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( ); # get borrower information .... -my $sth = - $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?"); - +my ( $borr, $flags ) = GetMemberDetails( $borrowernumber ); +my $sth = $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?"); +my $minpasslen = C4::Context->preference("minPasswordLength"); if ( $query->param('Oldkey') && $query->param('Newkey') && $query->param('Confirm') ) { if ( goodkey( $dbh, $borrowernumber, $query->param('Oldkey') ) ) { if ( $query->param('Newkey') eq $query->param('Confirm') - && length( $query->param('Confirm') ) > 5 ) + && length( $query->param('Confirm') ) >= $minpasslen ) { # Record password my $clave = md5_base64( $query->param('Newkey') ); $sth->execute( $clave, $borrowernumber ); @@ -65,7 +65,7 @@ if ( $query->param('Oldkey') $template->param( 'Error_messages' => '1' ); $template->param( 'PassMismatch' => '1' ); } - elsif ( length( $query->param('Confirm') ) <= 5 ) { + elsif ( length( $query->param('Confirm') ) < $minpasslen ) { $template->param( 'Ask_data' => '1' ); $template->param( 'Error_messages' => '1' ); $template->param( 'ShortPass' => '1' ); @@ -86,6 +86,11 @@ else { $template->param( 'Ask_data' => '1' ); } +$template->param(firstname => $borr->{'firstname'}, + surname => $borr->{'surname'}, + minpasslen => $minpasslen, +); + output_html_with_http_headers $query, $cookie, $template->output; sub goodkey { -- 2.39.5