From f27dcb038483f2b3b7d65bf8ac4c9022cfe1e458 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sun, 19 Mar 2017 16:28:35 +0000 Subject: [PATCH] Bug 12930 - Implemented error message display for invalid username or password on web installer login Now InstallAuth.pm hands the invalid_username_or_password variable to the template file auth.tt if the user entered an invalid username or password and this is displayed to the user --- C4/InstallAuth.pm | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/C4/InstallAuth.pm b/C4/InstallAuth.pm index c91bde8..445c18b 100644 --- a/C4/InstallAuth.pm +++ b/C4/InstallAuth.pm @@ -116,11 +116,11 @@ sub get_template_and_user { my $template = C4::Templates->new( $interface, $filename, $tmplbase, $query); my ( $user, $cookie, $sessionID, $flags ) = checkauth( - $in->{'query'}, - $in->{'authnotrequired'}, - $in->{'flagsrequired'}, - $in->{'type'} - ); + $in->{'query'}, + $in->{'authnotrequired'}, + $in->{'flagsrequired'}, + $in->{'type'} + ); # use Data::Dumper;warn "utilisateur $user cookie : ".Dumper($cookie); @@ -290,6 +290,7 @@ sub checkauth { my $password = $query->param('password'); C4::Context->_new_userenv($sessionID); my ( $return, $cardnumber ) = checkpw( $userid, $password ); + if ($return) { $loggedin = 1; # open L, ">>/tmp/sessionlog"; @@ -330,10 +331,10 @@ sub checkauth { } } else { - if ($userid) { - $info{'invalid_username_or_password'} = 1; - C4::Context->_unset_userenv($sessionID); - } + if ($userid) { + $info{'invalid_username_or_password'} = 1; + C4::Context->_unset_userenv($sessionID); + } } } @@ -379,6 +380,10 @@ sub checkauth { $template->param( login => 1 ); $template->param( loginprompt => 1 ) unless $info{'nopermission'}; + if ($info{'invalid_username_or_password'} == 1) { + $template->param( 'invalid_username_or_password' => $info{'invalid_username_or_password'}); + } + $template->param( \%info ); $cookie = $query->cookie( -name => 'CGISESSID', @@ -423,7 +428,10 @@ sub checkpw { # some features won't be effective : modify systempref, modify MARC structure, return 2; } - return 0; + else{ + + + } } END { } # module clean-up code here (global destructor) -- 2.1.4