Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
85fc8fec
Commit
85fc8fec
authored
Dec 10, 2016
by
Micheal Mand
Committed by
Nicolas Widart
Dec 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more graceful handling of TokenMismatchException (#300)
parent
09746122
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
core.php
Modules/Translation/Resources/lang/core/en/core.php
+1
-0
Handler.php
app/Exceptions/Handler.php
+8
-0
No files found.
Modules/Translation/Resources/lang/core/en/core.php
View file @
85fc8fec
...
@@ -62,6 +62,7 @@ return [
...
@@ -62,6 +62,7 @@ return [
'create resource'
=>
'Create :name'
,
'create resource'
=>
'Create :name'
,
'edit resource'
=>
'Edit :name'
,
'edit resource'
=>
'Edit :name'
,
'destroy resource'
=>
'Delete :name'
,
'destroy resource'
=>
'Delete :name'
,
'error token mismatch'
=>
'Your session timed out, please submit the form again.'
,
'error 404'
=>
'404'
,
'error 404'
=>
'404'
,
'error 404 title'
=>
'Oops! This page was not found.'
,
'error 404 title'
=>
'Oops! This page was not found.'
,
'error 404 description'
=>
'The page you are looking for was not found.'
,
'error 404 description'
=>
'The page you are looking for was not found.'
,
...
...
app/Exceptions/Handler.php
View file @
85fc8fec
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
App\Exceptions
;
namespace
App\Exceptions
;
use
Exception
;
use
Exception
;
use
Illuminate\Session\TokenMismatchException
;
use
Illuminate\Validation\ValidationException
;
use
Illuminate\Validation\ValidationException
;
use
Illuminate\Auth\Access\AuthorizationException
;
use
Illuminate\Auth\Access\AuthorizationException
;
use
Illuminate\Database\Eloquent\ModelNotFoundException
;
use
Illuminate\Database\Eloquent\ModelNotFoundException
;
...
@@ -23,6 +24,7 @@ class Handler extends ExceptionHandler
...
@@ -23,6 +24,7 @@ class Handler extends ExceptionHandler
AuthorizationException
::
class
,
AuthorizationException
::
class
,
HttpException
::
class
,
HttpException
::
class
,
ModelNotFoundException
::
class
,
ModelNotFoundException
::
class
,
TokenMismatchException
::
class
,
ValidationException
::
class
,
ValidationException
::
class
,
];
];
...
@@ -63,6 +65,12 @@ class Handler extends ExceptionHandler
...
@@ -63,6 +65,12 @@ class Handler extends ExceptionHandler
return
$this
->
handleExceptions
(
$e
);
return
$this
->
handleExceptions
(
$e
);
}
}
if
(
$e
instanceof
TokenMismatchException
)
{
return
redirect
()
->
back
()
->
withInput
(
$request
->
except
(
'password'
))
->
withErrors
(
trans
(
'core::core.error token mismatch'
));
}
return
parent
::
render
(
$request
,
$e
);
return
parent
::
render
(
$request
,
$e
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment