Frontend: Add logout_action
This commit is contained in:
parent
1e7bea8e5f
commit
eaea93fb9e
@ -116,6 +116,13 @@ sub handlePath {
|
|||||||
$aClient->send($response);
|
$aClient->send($response);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
when("/logout_action") {
|
||||||
|
if(defined($aRequest->{"cookies"}{"session"})) {
|
||||||
|
frontend_session::deleteSession($aRequest->{"cookies"}{"session"});
|
||||||
|
}
|
||||||
|
frontend::redirect($aClient, "/");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
when("/view_logs") {
|
when("/view_logs") {
|
||||||
my $channelID = $aRequest->{"path"}{"parameters"}{"channel"};
|
my $channelID = $aRequest->{"path"}{"parameters"}{"channel"};
|
||||||
if(!defined($channelID)) {
|
if(!defined($channelID)) {
|
||||||
|
@ -27,6 +27,14 @@ sub newSessionToken {
|
|||||||
return Digest::SHA::sha256_hex(sprintf("%x", rand(0xFFFFFFFF)));
|
return Digest::SHA::sha256_hex(sprintf("%x", rand(0xFFFFFFFF)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub deleteSession {
|
||||||
|
my $aSession = $_[0];
|
||||||
|
|
||||||
|
if(isValidSession($aSession)) {
|
||||||
|
delete $sessions{$aSession};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub isValidSession {
|
sub isValidSession {
|
||||||
my $aSession = $_[0];
|
my $aSession = $_[0];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user