aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2012-09-01 20:12:34 +0200
committerGuilhem Moulin <guilhem.moulin@fripost.org>2012-09-01 21:03:20 +0200
commitec2ed6c255ca97f39d4a58071f8558744bd9958d (patch)
treef8e248356f6b8ec8600cf485716aedcf9dba992f
parent79344b1efee7e914b8d23bd0dfd92664cf698c11 (diff)
cgi-bin
-rwxr-xr-xcgi-bin/index.cgi (renamed from index.cgi)0
-rw-r--r--lib/FPanel/Login.pm16
-rwxr-xr-xserver.pl2
-rw-r--r--template/domain-list.html2
-rw-r--r--template/login.html3
5 files changed, 15 insertions, 8 deletions
diff --git a/index.cgi b/cgi-bin/index.cgi
index 9ac0e6e..9ac0e6e 100755
--- a/index.cgi
+++ b/cgi-bin/index.cgi
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 @@
<div class="right column">
Logged as <a href="<TMPL_VAR NAME=URL>/<TMPL_VAR NAME=USER_DOMAINPART>/<TMPL_VAR NAME=USER_LOCALPART>/?a=edit"
><TMPL_VAR NAME=USER_LOCALPART>@<TMPL_VAR NAME=USER_DOMAINPART></a>
- | <a href="<TMPL_VAR NAME=URL>?a=logout">Log out</a>
+ | <a href="<TMPL_VAR NAME=URL>/?a=logout">Log out</a>
</div>
<br/>
</div>
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 @@
<h2>Administrator Panel</h2>
<br/>
<br/>
- <form class="loginform" name="loginform"
- method="post" action="./" >
+ <form class="loginform" name="loginform" method="post" >
<table class="loginform">
<tr>
<td class="label">Username</td>