Hello,
i use Kirby 2.2.3 and have added a login on the website for one site as described in the Cookbook " Authentication" link. I want to protect one sepcific site from the website (like: example.de/test), so that only logged in users can see this site. Unfortunately if i go direct to the adress (in this example exmaple.de jetzt kaufen!) i can see the site and the redirect to the main page (example.de) does not work. I know that the login works, because the content (one pdf file) can only be donwloaded if the user is logged in.
In the template of the site i want to protect i added <?php if(!$site->user()) go('/') ?>
at the first line.
The template /site/templates/test.php looks like this:
<?php if(!$site->user()) go('/') ?>
<?php if(!defined('KIRBY')) exit;
snippet("header"); ?>
<main class="block site-width content-default" role="main" id="intro">
<?php snippet("intro-logo"); ?>
<h1><?php echo $page->title()->html() ?></h1>
<?php echo $page->text()->kirbytext() ?>
<?php if($user = $site->user()): ?>
<li>
<a href="<?= url('logout') ?>">Logout</a>
</li>
<?php endif ?>
</main>
<?php snippet('footer') ?>
I have already ask a question related to this topic: Link
Is there something i am missing? I checked all the code a few times with the cookbook and searched the forum, but i do not find any soultion. If any information is missing, I will complete it.
Thanks for your help and i hope i have clearly desribed my problem.