Handle token mismatch in get_started route

This commit is contained in:
Hillel Coren 2016-02-28 20:54:31 +02:00
parent 553c548f31
commit d465c0d019

View File

@ -47,6 +47,8 @@ class Handler extends ExceptionHandler {
if ($e instanceof ModelNotFoundException) { if ($e instanceof ModelNotFoundException) {
return Redirect::to('/'); return Redirect::to('/');
} elseif ($e instanceof \Illuminate\Session\TokenMismatchException) { } elseif ($e instanceof \Illuminate\Session\TokenMismatchException) {
// prevent loop since the page auto-submits
if ($request->path() != 'get_started') {
// https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e // https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e
return redirect() return redirect()
->back() ->back()
@ -55,6 +57,7 @@ class Handler extends ExceptionHandler {
'warning' => trans('texts.token_expired') 'warning' => trans('texts.token_expired')
]); ]);
} }
}
// In production, except for maintenance mode, we'll show a custom error screen // In production, except for maintenance mode, we'll show a custom error screen
if (Utils::isNinjaProd() && !Utils::isDownForMaintenance()) { if (Utils::isNinjaProd() && !Utils::isDownForMaintenance()) {