Bug 25491: Fix for "Use of uninitialized value" in InstallAuth.pm
[koha-ffzg.git] / C4 / InstallAuth.pm
index 6922d04..2c866b2 100644 (file)
@@ -17,8 +17,7 @@ package C4::InstallAuth;
 # 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; FIXME - Bug 2505
+use Modern::Perl;
 use Digest::MD5 qw(md5_base64);
 use CGI::Session;
 use File::Spec;
@@ -29,7 +28,6 @@ use C4::Context;
 use C4::Output;
 use C4::Templates;
 use C4::Koha;
-use Koha::UploadedFile;
 
 use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
@@ -97,7 +95,7 @@ InstallAuth - Authenticates Koha users for Install process
 
     The C<template_name> is then used to find the correct template for
     the page. The authenticated users details are loaded onto the
-    template in the HTML::Template LOOP variable C<USER_INFO>. Also the
+    template in the logged_in_user variable (which is a Koha::Patron object). Also the
     C<sessionID> is passed to the template. This can be used in templates
     if cookies are disabled. It needs to be put as and input to every
     authenticated page.
@@ -149,6 +147,7 @@ sub get_template_and_user {
             $template->param( CAN_user_editauthorities  => 1 );
             $template->param( CAN_user_serials          => 1 );
             $template->param( CAN_user_reports          => 1 );
+            $template->param( CAN_user_problem_reports   => 1 );
         }
 
         my $minPasswordLength = C4::Context->preference('minPasswordLength');
@@ -239,7 +238,7 @@ sub checkauth {
     my $dbh = C4::Context->dbh();
     my $template_name;
     $template_name = "installer/auth.tt";
-    my $sessdir = File::Spec->catdir( Koha::UploadedFile->temporary_directory, 'cgisess_' . C4::Context->config('database') ); # same construction as in C4/Auth
+    my $sessdir = File::Spec->catdir( C4::Context::temporary_directory, 'cgisess_' . C4::Context->config('database') ); # same construction as in C4/Auth
 
     # state variables
     my $loggedin = 0;
@@ -261,8 +260,7 @@ sub checkauth {
                 $session->param('branch'),
                 $session->param('branchname'),
                 $session->param('flags'),
-                $session->param('emailaddress'),
-                $session->param('branchprinter')
+                $session->param('emailaddress')
             );
             $cookie = $query->cookie(
                 -name     => 'CGISESSID',
@@ -386,7 +384,7 @@ sub checkauth {
     $template->param( login => 1 );
     $template->param( loginprompt => 1 ) unless $info{'nopermission'};
 
-    if ($info{'invalid_username_or_password'} == 1) {
+    if ($info{'invalid_username_or_password'} && $info{'invalid_username_or_password'} == 1) {
                 $template->param( 'invalid_username_or_password' => $info{'invalid_username_or_password'});
     }