From ec2ed6c255ca97f39d4a58071f8558744bd9958d Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 1 Sep 2012 20:12:34 +0200 Subject: cgi-bin --- cgi-bin/index.cgi | 18 ++++++++++++++++++ index.cgi | 18 ------------------ lib/FPanel/Login.pm | 16 ++++++++++++---- server.pl | 2 +- template/domain-list.html | 2 +- template/login.html | 3 +-- 6 files changed, 33 insertions(+), 26 deletions(-) create mode 100755 cgi-bin/index.cgi delete mode 100755 index.cgi diff --git a/cgi-bin/index.cgi b/cgi-bin/index.cgi new file mode 100755 index 0000000..9ac0e6e --- /dev/null +++ b/cgi-bin/index.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use utf8; + +use lib 'lib'; +use FPanel::Interface; +# TODO: Try out Fast CGI +#use CGI::Fast(); +# +#while (my $q = new CGI::Fast){ +# my $app = new WebApp(QUERY => $q); +# $app->run(); +#} + +my $cgi = FPanel::Interface->new(); +$cgi->run(); diff --git a/index.cgi b/index.cgi deleted file mode 100755 index 9ac0e6e..0000000 --- a/index.cgi +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use utf8; - -use lib 'lib'; -use FPanel::Interface; -# TODO: Try out Fast CGI -#use CGI::Fast(); -# -#while (my $q = new CGI::Fast){ -# my $app = new WebApp(QUERY => $q); -# $app->run(); -#} - -my $cgi = FPanel::Interface->new(); -$cgi->run(); diff --git a/lib/FPanel/Login.pm b/lib/FPanel/Login.pm index dc5ae3a..55188f6 100644 --- a/lib/FPanel/Login.pm +++ b/lib/FPanel/Login.pm @@ -30,7 +30,7 @@ sub cgiapp_init { ], DEFAULT_EXPIRY => '+24h', COOKIE_PARAMS => { -name => 'FripostAdminPanel_SessAuth' - , -path => '/index.cgi/' + , -path => '/cgi-bin/' # Expires when the browser quits , -expires => -1 ,'-max-age' => -1 @@ -99,6 +99,7 @@ sub mymode_param { # $domain = $path[1]; $mode = 'index'; } + print STDERR $q->self_url, "\n"; print STDERR $ENV{PATH_INFO} . '?' . $q->query_string . " -> " . $mode @@ -124,7 +125,7 @@ sub login : Runmode { $self->query->param('a') eq 'login'; # A logged user has no reason to ask for a relogin - $self->authen->logout() if defined $self->authen->username; + $self->authen->logout if $self->authen->is_authenticated; $self->query->param( destination => $self->query->self_url) unless (defined $self->query->param('destination')); @@ -151,11 +152,18 @@ sub login_box { sub logout : Runmode { my $self = shift; - if ($self->authen->username) { + if ($self->authen->is_authenticated) { $self->authen->logout; $self->session->delete; + $self->session->flush; } - return $self->redirect($self->query->url . '/'); + + # Do not come back here afterwards + $self->query->delete( 'a' ) + if (defined $self->query->param('a')) and + $self->query->param('a') eq 'logout'; + + return $self->redirect($self->query->self_url); } sub error_rm : ErrorRunmode { diff --git a/server.pl b/server.pl index bc76168..3a1ac83 100755 --- a/server.pl +++ b/server.pl @@ -17,7 +17,7 @@ my $server = CGI::Application::Server->new(); #); $server->entry_points({ - '/index.cgi' => #$panel + '/cgi-bin' => #$panel 'FPanel::Interface' }); $server->run(); diff --git a/template/domain-list.html b/template/domain-list.html index 52d819e..fcc7b23 100644 --- a/template/domain-list.html +++ b/template/domain-list.html @@ -13,7 +13,7 @@
Logged as @ - | Log out + | Log out

diff --git a/template/login.html b/template/login.html index e0f648b..6ed2a7e 100644 --- a/template/login.html +++ b/template/login.html @@ -16,8 +16,7 @@

Administrator Panel



-
+ -- cgit v1.2.3
Username