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
b3a544d5
Unverified
Commit
b3a544d5
authored
Sep 16, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle the ajax case of unauthenticated
parent
5d84e8f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
AdminMiddleware.php
Modules/Core/Http/Middleware/AdminMiddleware.php
+5
-1
No files found.
Modules/Core/Http/Middleware/AdminMiddleware.php
View file @
b3a544d5
...
...
@@ -5,6 +5,7 @@ namespace Modules\Core\Http\Middleware;
use
Illuminate\Foundation\Application
;
use
Illuminate\Http\Request
;
use
Illuminate\Routing\Redirector
;
use
Illuminate\Http\Response
;
use
Illuminate\Session\Store
;
use
Modules\User\Contracts\Authentication
;
...
...
@@ -51,6 +52,9 @@ class AdminMiddleware
{
// Check if the user is logged in
if
(
!
$this
->
auth
->
check
())
{
if
(
$request
->
ajax
())
{
return
response
(
'Unauthenticated.'
,
Response
::
HTTP_UNAUTHORIZED
);
}
// Store the current uri in the session
$this
->
session
->
put
(
'url.intended'
,
$this
->
request
->
url
());
...
...
@@ -61,7 +65,7 @@ class AdminMiddleware
// Check if the user has access to the dashboard page
if
(
!
$this
->
auth
->
hasAccess
(
'dashboard.index'
))
{
// Show the insufficient permissions page
return
$this
->
application
->
abort
(
403
);
return
$this
->
application
->
abort
(
Response
::
HTTP_FORBIDDEN
);
}
return
$next
(
$request
);
...
...
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