[vhffs-dev] [1919] add error messages when session file cannot be created upon login

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1919
Author:   gradator
Date:     2012-01-22 00:42:06 +0100 (Sun, 22 Jan 2012)
Log Message:
-----------
add error messages when session file cannot be created upon login

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/Auth.pm

Modified: trunk/vhffs-api/src/Vhffs/Panel/Auth.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Auth.pm	2012-01-19 23:57:57 UTC (rev 1918)
+++ trunk/vhffs-api/src/Vhffs/Panel/Auth.pm	2012-01-21 23:42:06 UTC (rev 1919)
@@ -83,7 +83,7 @@
 		my $oldsid = $cgi->cookie( CGI::Session::name() );
 		if( defined $oldsid ) {
 			my $oldsession = new CGI::Session(undef, $oldsid, {Directory=>'/tmp'});
-			$oldsession->delete();
+			$oldsession->delete() if defined $oldsession;
 		}
 	
 		my $username = $cgi->param('username');
@@ -98,6 +98,11 @@
 		} else {
 			# Creates the new session
 			my $session = new CGI::Session('driver:File', undef, {Directory=>'/tmp'});
+			unless( defined $session ) {
+				$panel->add_error( gettext('Cannot create or fetch session file, please check that /tmp is readable and writeable') );
+				display_login( $panel );
+				return;
+			}
 			$session->expires('+1h');
 			$session->param('username', $user->get_username);
 			$session->param('uid', $user->get_uid);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/