我正在使用用户结霜 V4。我了解了路由的概念。
现在我想让我的索引页面成为一个安全页面——这意味着只有登录的用户才能访问该页面。
如果用户没有登录,他应该被重定向到登录页面。
我做了以下事情:
我定义了自己的路由:
$app->get('/', 'UserFrosting\Sprinkle\Core\Controller\CoreController:pageIndex')
->add('checkEnvironment')
->setName('index')
->add('authGuard');
现在,当我访问该站点时,我得到了异常。它不会重定向到登录页面:account/sign-in
我收到以下错误:
UserFrosting Application Error
The application could not run because of the following error:
Details
Type: UserFrosting\Sprinkle\Account\Authenticate\Exception\AuthExpiredException
File: C:\wamp64\www\UserFrosting_V4\app\sprinkles\account\src\Authenticate\AuthGuard.php
Line: 50