Welcome Guest, Not a member yet? Register   Sign In
Shield problem with a view that extends a layout
#1

Hi all, I'm new here and I'm a beginner with CI..
I have Shield installed and I noticed that it only works if the view is simple and doesn't extend a layout.
My Auth.php, AuthGroups.php are the default ones.

Filters.php (customized part only):
PHP Code:
public array $globals = [
        'before' => [
            // 'honeypot',
            // 'csrf',
            // 'invalidchars',
            'session' => ['except' => ['login*''register''auth/a/*']],
        ],
        'after' => [
            'toolbar',
            // 'honeypot',
            // 'secureheaders',
        ],
    ]; 

Routes.php:
PHP Code:
$routes->get('/''Example::index');

service('auth')->routes($routes); 

Example.php (controller):
PHP Code:
namespace App\Controllers;

class 
Example extends BaseController
{
    public function index()
    {
        return view('example');
    }


1) example.php (view, without layout):
PHP Code:
<h3>Example page</h3

2) example.php (view, if it extends a layout):
PHP Code:
<?= $this->extend('layout'?>
<?= $this
->section('content'?>
<h3>Example page</h3>
<?= $this->endSection() ?>

With the view 1), after logging in, I get the user logged in.
With the view 2) the view is displayed but the user remains not logged in (even if he has entered the correct credentials).
What's wrong? Thanks.






Reply


Messages In This Thread
Shield problem with a view that extends a layout - by SalDeF - 05-14-2023, 10:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB