1

我正在使用用户结霜 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

4

1 回答 1

2

它重定向到生产模式下的登录页面。

https://github.com/userfrosting/UserFrosting/blob/master/app/.env.example#L4

将其设置为production

于 2017-05-29T13:13:36.520 回答