Session verification-related changes
This commit is contained in:
parent
cf91c02ba0
commit
6cf65a8edd
|
@ -106,13 +106,15 @@ sub startup {
|
|||
$self->helper(session_verify => sub {
|
||||
my $self = shift;
|
||||
|
||||
# get info from user's session cookie and store it in vars
|
||||
my $_user_id = $self->session('user_id');
|
||||
my $_session_key = $self->session('session_key');
|
||||
|
||||
my $_validity = 1;
|
||||
my $_catch_error;
|
||||
|
||||
# get info from user's session cookie and store it in vars
|
||||
my $_user_id = $self->session('user_id');
|
||||
my $_session_key = $self->session('session_key');
|
||||
my $_is_auth = $self->session('is_auth');
|
||||
|
||||
if ($_is_auth) {
|
||||
try {
|
||||
# check to see if session with this id is present in db
|
||||
($self->schema->resultset('Session')->search
|
||||
|
@ -135,6 +137,9 @@ sub startup {
|
|||
$_validity = undef;
|
||||
$self->session_destroy;
|
||||
}
|
||||
} else {
|
||||
$_validity = 0;
|
||||
}
|
||||
|
||||
return $_validity;
|
||||
});
|
||||
|
|
|
@ -12,6 +12,10 @@ use Tree::Simple;
|
|||
sub index {
|
||||
my $self = shift;
|
||||
|
||||
if ($self->session_verify eq undef) {
|
||||
$self->redirect_to('/')
|
||||
}
|
||||
|
||||
$self->render(
|
||||
template => 'index',
|
||||
category_tree => $self->model('forums')->list_full
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
my $userControls;
|
||||
|
||||
# TODO: once implemented, put username + profile link first
|
||||
if ($self->session('is_auth') == 1) {
|
||||
my $username =
|
||||
if ($self->session('is_auth')) {
|
||||
my $username = '';
|
||||
$userControls = "<a href=\"/logout\">logout</a>"}
|
||||
else {
|
||||
$userControls =
|
||||
|
|
Loading…
Reference in New Issue