[vhffs-dev] [2184] get_session should return undef or a session, never a template result |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 2184
Author: gradator
Date: 2012-05-10 21:51:01 +0200 (Thu, 10 May 2012)
Log Message:
-----------
get_session should return undef or a session, never a template result
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Panel.pm
Modified: trunk/vhffs-api/src/Vhffs/Panel.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel.pm 2012-05-10 19:20:35 UTC (rev 2183)
+++ trunk/vhffs-api/src/Vhffs/Panel.pm 2012-05-10 19:51:01 UTC (rev 2184)
@@ -261,13 +261,15 @@
my $sid = $cgi->cookie( CGI::Session::name() );
unless( defined $sid ) {
$panel->add_error( gettext('No cookie found, please accept the cookie and then please login again !') );
- return Vhffs::Panel::Auth::display_login( $panel );
+ Vhffs::Panel::Auth::display_login( $panel );
+ return;
}
my $session = new CGI::Session('driver:File', $sid, { Directory => '/tmp' } );
unless( defined $session ) {
$panel->add_error( gettext('Cannot fetch session file, please check that /tmp is readable and writeable') );
- return Vhffs::Panel::Auth::display_login( $panel );
+ Vhffs::Panel::Auth::display_login( $panel );
+ return;
}
my $uid = $session->param('uid');
@@ -275,7 +277,8 @@
$panel->add_error( gettext('Expired session ! Please login again') );
$session->delete();
$session->flush(); # Recommended practice says use flush() after delete().
- return Vhffs::Panel::Auth::display_login( $panel );
+ Vhffs::Panel::Auth::display_login( $panel );
+ return;
}
my $user = Vhffs::User::get_by_uid($vhffs, $uid);
@@ -283,14 +286,16 @@
$panel->add_error( gettext('User does not exist') );
$session->delete();
$session->flush(); # Recommended practice says use flush() after delete().
- return Vhffs::Panel::Auth::display_login( $panel );
+ Vhffs::Panel::Auth::display_login( $panel );
+ return;
}
unless( $user->get_status == Vhffs::Constants::ACTIVATED ) {
$panel->add_error( gettext('You\'re are not allowed to browse panel') );
$session->delete();
$session->flush(); # Recommended practice says use flush() after delete().
- return Vhffs::Panel::Auth::display_login( $panel );
+ Vhffs::Panel::Auth::display_login( $panel );
+ return;
}
$panel->{session} = $session;