add logout link
This commit is contained in:
parent
ad585c3fec
commit
833c8878d1
2 changed files with 23 additions and 1 deletions
8
index.pl
8
index.pl
|
@ -504,7 +504,7 @@ helper 'get_user_id' => sub {
|
||||||
else {
|
else {
|
||||||
$self->app->add_user_query->execute($user_name);
|
$self->app->add_user_query->execute($user_name);
|
||||||
$self->app->get_userid_query->execute($user_name);
|
$self->app->get_userid_query->execute($user_name);
|
||||||
my $rows = $self->app->get_userid_query->fetchall_arrayref;
|
$rows = $self->app->get_userid_query->fetchall_arrayref;
|
||||||
return $rows->[0][0];
|
return $rows->[0][0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -837,6 +837,12 @@ post '/x/login' => sub {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
get '/x/logout' => sub {
|
||||||
|
my ($self) = @_;
|
||||||
|
$self->logout;
|
||||||
|
$self->redirect_to('/x/login');
|
||||||
|
};
|
||||||
|
|
||||||
get '/x/register' => sub {
|
get '/x/register' => sub {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
$self->render('register');
|
$self->render('register');
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
% if (my $user = current_user()) {
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="card grey darken-4">
|
||||||
|
<div class="card-content white-text">
|
||||||
|
<span class="card-title">Hallo, <%= $user->{name} %>!</span>
|
||||||
|
<p>
|
||||||
|
Du bist bereits angemeldet. Falls du mehrere Accounts hast
|
||||||
|
und auf einen anderen wechseln möchtest, musst du dich
|
||||||
|
vorher <a href="/x/logout">abmelden</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
% }
|
||||||
% if (my $invalid = stash('invalid')) {
|
% if (my $invalid = stash('invalid')) {
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
|
|
Loading…
Reference in a new issue