Reputation: 542
I am using User Frosting V4. I learned about the routing concept.
Now I wanted to make my index page a secure page - which means only logged in users should be able to access the page.
If user is not logged in, he should be redirected to Sign In page.
I did the following :
I defined my own routing :
$app->get('/', 'UserFrosting\Sprinkle\Core\Controller\CoreController:pageIndex')
->add('checkEnvironment')
->setName('index')
->add('authGuard');
Now, when I access the site, I get the Exception. It does not redirect to the login page : account/sign-in
I get the following error :
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
Upvotes: 1
Views: 270
Reputation: 344
It redirects to the sign in page in production mode.
https://github.com/userfrosting/UserFrosting/blob/master/app/.env.example#L4
Set that to production
Upvotes: 2