From d465c0d01952805e448ebecafacb9a1b348e3ee3 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 28 Feb 2016 20:54:31 +0200 Subject: [PATCH] Handle token mismatch in get_started route --- app/Exceptions/Handler.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index ba656f6c0131..9d17fb099057 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -47,13 +47,16 @@ class Handler extends ExceptionHandler { if ($e instanceof ModelNotFoundException) { return Redirect::to('/'); } elseif ($e instanceof \Illuminate\Session\TokenMismatchException) { - // https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e - return redirect() - ->back() - ->withInput($request->except('password', '_token')) - ->with([ - 'warning' => trans('texts.token_expired') - ]); + // prevent loop since the page auto-submits + if ($request->path() != 'get_started') { + // https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e + return redirect() + ->back() + ->withInput($request->except('password', '_token')) + ->with([ + 'warning' => trans('texts.token_expired') + ]); + } } // In production, except for maintenance mode, we'll show a custom error screen