From b38094984d3bcda34ea86189e2167fd5dac4d8df Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 9 Sep 2022 09:18:10 +0000 Subject: [PATCH] Bug 30588: (QA follow-up) Auth - remove two warns and second logout Content-Type: text/plain; charset=utf-8 Resolves: Use of uninitialized value $request_method in string eq at /usr/share/koha/C4/Auth.pm line 1122. Use of uninitialized value $return in numeric gt (>) at /usr/share/koha/C4/Auth.pm line 1155. We also remove the double logout from Auth.t Test plan: Run t/db_dependent/Auth.t Check if you do not see the warns anymore. Signed-off-by: Marcel de Rooy --- C4/Auth.pm | 4 ++-- t/db_dependent/Auth.t | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index eb5be20cea..5ca5fa0b1e 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1117,7 +1117,7 @@ sub checkauth { } else { my $retuserid; - my $request_method = $query->request_method(); + my $request_method = $query->request_method // q{}; if ( $request_method eq 'POST' @@ -1152,7 +1152,7 @@ sub checkauth { } # $return: 1 = valid user - if ($return > 0) { + if( $return && $return > 0 ) { if ( $flags = haspermission( $userid, $flagsrequired ) ) { $auth_state = "logged_in"; diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t index 2ed7bc5db5..83e15bdf05 100755 --- a/t/db_dependent/Auth.t +++ b/t/db_dependent/Auth.t @@ -241,7 +241,6 @@ subtest 'checkauth() tests' => sub { is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA-setup'), 1, 'Setup 2FA required' ); logout($cgi); - logout($cgi); ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'opac' ); is( $userid, $patron->userid, 'Succesful login at the OPAC' ); is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'No second auth required at the OPAC' ); -- 2.20.1