Ad
CSRF Token Empty When The Website Is In Maintenance Mode
My goal is to still allow administrators to login to the website, even in maintenance mode.
However, when the website is in maintenance mode (using php artisan down
), Laravel won't generate any CSRF Token.
csrf_token()
is returning an empty string, and csrf_field()
is returning <input type="hidden" name="_token" value="">
This issue won't occur if the website is not in maintenance mode.
Is it possible to force the generation of the token?
Ad
Answer
One solution which can fit for you is to disable csrf token for your admin route when maintenance mode is enabled
To do this open
App\Http\Middleware\VerifyCsrfToken
and add
protected $except = [
'/your/route'
];
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad