Login on website only reload

Hello,
I want to use a login on the website and have followed the cookbook " Authentication". But unfortunately the login does not work. When clicking on login, the page is only reloaded. Logging into the panel works, but when I log in to the panel, I can also access the logged in user page, and the logout on the page also works. I checked the code several times. Also, I do not see an error message. Is there something missing? I searched in the forum but found no solution. The accounts I used to login are admin and editor accounts. If any information is missing, I will complete it.
Thank you for your help!

Is the debug setting enabled?
Could you try to add this in your controller:

var_dump(get('username'));
var_dump(get('password'));

immediately after

if(r::is('post') and get('login')) {

?

I just want to be sure your code gets that far.

Thank you very much for your reply!
I have debugging enabled.
I added it to the controller but still only reload. The fields are empty after the reload. I tested it with the added lines with chrome and edge but in both browsers is the problem still there.

@Florian:

I use only german language, all three files have the same name and are in the same folders like in the cookbook. Only in the /site/templates/login.php
my first lines look like this
<?php if(!defined(β€˜KIRBY’)) exit;
snippet(β€œheader”); ?>

my config.php is

c::set('locale','de_DE.UTF-8');

c::set('panel.widgets', array(
  'pages'    => true,
  'newproject' => true,
  'history'  => true,
  'site'     => true,
  'account' => true
));

c::set('cache', true);
c::set('cache.driver', 'file');
c::set('cache.ignore', array('sitemap'));

c::set('roles', array(
  array(
    'id'      => 'admin',
    'name'    => 'Admin',
    'default' => true,
    'panel'   => true
  ),
  array(
    'id'      => 'editor',
    'name'    => 'Editor',
    'panel'   => true
  ),
  array(
    'id'      => 'client',
    'name'    => 'Client',
    'panel'   => false
      )
    ));

c::set('routes', array(
   array(
    'pattern' => 'logout',
    'action'  => function() {
      if($user = site()->user()) $user->logout();
      go('login');
    }
  )
));

c::set('debug', true);

the url looks like this www. mywebsite .de/login

Please add the page with the form to the cache.ignore.

2 Likes

Now it works with the login page added to the cache.ignore ,
thank you very much! :slight_smile:

I think this should be added to the docs:

1 Like