From 16d7cb2ea3e18168a0848dec93bf6b2c54aeb941 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 23 Aug 2007 20:51:50 -0500 Subject: [PATCH] Fixing a bug that occured if Koha wasnt installed, but a cookie was set in the browser Signed-off-by: Chris Cormack --- C4/Auth.pm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 68ed79d9d9..203388b18d 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -382,9 +382,15 @@ sub checkauth { $session->param('emailaddress'), $session->param('branchprinter') ); } - my $ip=$session->param('ip'); - $userid = $session->param('id'); - my $lasttime = $session->param('lasttime'); + my $ip; + my $lasttime; + if ($session) { + $ip = $session->param('ip'); + $lasttime = $session->param('lasttime'); + $userid = $session->param('id'); + } + + if ($logout) { # voluntary logout the user @@ -443,7 +449,10 @@ sub checkauth { } unless ($userid) { my $session = new CGI::Session("driver:MySQL", undef, {Handle=>$dbh}); - my $sessionID = $session->id; + my $sessionID; + if ($session) { + $sessionID = $session->id; + } $userid = $query->param('userid'); C4::Context->_new_userenv($sessionID); my $password = $query->param('password'); @@ -610,6 +619,7 @@ sub checkauth { # check that database and koha version are the same # there is no DB version, it's a fresh install, # go to web installer + warn "about to check version"; unless (C4::Context->preference('Version')){ if ($type ne 'opac'){ warn "Install required, redirecting to Installer"; -- 2.39.5