Toolbar with logout button
This commit is contained in:
parent
2afe5b1918
commit
ec72bd2a1e
|
@ -57,11 +57,20 @@ hook 'before' => sub {
|
||||||
my $uid = cookieval("id");
|
my $uid = cookieval("id");
|
||||||
my $token = cookieval("token");
|
my $token = cookieval("token");
|
||||||
my $auth = 0;
|
my $auth = 0;
|
||||||
|
my $email;
|
||||||
if ($uid && $token) {
|
if ($uid && $token) {
|
||||||
$auth = get_auth($uid, $token);
|
$auth = get_auth($uid, $token);
|
||||||
|
$email = database->quick_lookup(
|
||||||
|
"user",
|
||||||
|
{
|
||||||
|
"id" => $uid,
|
||||||
|
},
|
||||||
|
"email",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var auth => $auth;
|
var auth => $auth;
|
||||||
|
var email => $email;
|
||||||
};
|
};
|
||||||
|
|
||||||
get qr{^/(index)?$} => sub {
|
get qr{^/(index)?$} => sub {
|
||||||
|
@ -183,4 +192,12 @@ post '/login' => sub {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
post '/logout' => sub {
|
||||||
|
cookie 'id' => undef;
|
||||||
|
cookie 'token' => undef;
|
||||||
|
template 'redir' => {
|
||||||
|
"redir" => "index",
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
true;
|
true;
|
||||||
|
|
|
@ -26,6 +26,9 @@ p {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
.toolbar {
|
||||||
|
border: 1px solid white;
|
||||||
|
}
|
||||||
|
|
||||||
a.bracketButton {
|
a.bracketButton {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -33,6 +36,17 @@ a.bracketButton {
|
||||||
a.bracketButton:hover {
|
a.bracketButton:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
button.textButton {
|
||||||
|
background: none !important;
|
||||||
|
color: inherit;
|
||||||
|
border: none;
|
||||||
|
padding: 0 !important;
|
||||||
|
font: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
button.textButton:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
form.login>table>tbody>tr>td>label {
|
form.login>table>tbody>tr>td>label {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
|
@ -49,6 +63,20 @@ table.domains>tbody>tr>td:first-child>* {
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<% IF vars.auth %>
|
||||||
|
<div class="toolbar">
|
||||||
|
<div class="body">
|
||||||
|
<span>
|
||||||
|
Logged in as <% vars.email | html_entity %>
|
||||||
|
</span>
|
||||||
|
<span style="float:right;">
|
||||||
|
<form action="/logout" method="POST">
|
||||||
|
[ <button class="textButton" action="submit">log out</button> ]
|
||||||
|
</form>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% END %>
|
||||||
<% content %>
|
<% content %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue