hello,
i want to implement a simple login/logout function, so i check out Access forbidden | Kirby CMS.
i put in config.php
return [
'routes' => [
[
'pattern' => 'logout',
'action' => function() {
if ($user = kirby()->user()) {
$user->logout();
}
go('login');
}
]
]
];
in my default template:
<?php if ($user = $kirby->user()): ?>
<a href="<?= url('logout') ?>">Logout</a>
<?php endif ?>
when i hit the logout button it redirects to /logout, but on that page the logout button is still displayed (meaning still logged in?) and it didnt redirect to /login. what could be the reason?
tnx and regards
fusi