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
0938024b
Commit
0938024b
authored
Oct 03, 2018
by
Micheal Mand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Authenticate middleware to match Laravel 5.7
parent
3f0ff1ee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
19 deletions
+8
-19
Kernel.php
app/Http/Kernel.php
+2
-2
Authenticate.php
app/Http/Middleware/Authenticate.php
+6
-17
No files found.
app/Http/Kernel.php
View file @
0938024b
...
...
@@ -14,7 +14,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected
$middleware
=
[
\
Illuminate\Foundation
\Http\Middleware\CheckForMaintenanceMode
::
class
,
\
App
\Http\Middleware\CheckForMaintenanceMode
::
class
,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize
::
class
,
\App\Http\Middleware\TrimStrings
::
class
,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull
::
class
,
...
...
@@ -51,7 +51,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected
$routeMiddleware
=
[
'auth'
=>
\
Illuminate\Auth
\Middleware\Authenticate
::
class
,
'auth'
=>
\
App\Http
\Middleware\Authenticate
::
class
,
'auth.basic'
=>
\Illuminate\Auth\Middleware\AuthenticateWithBasicAuth
::
class
,
'bindings'
=>
\Illuminate\Routing\Middleware\SubstituteBindings
::
class
,
'cache.headers'
=>
\Illuminate\Http\Middleware\SetCacheHeaders
::
class
,
...
...
app/Http/Middleware/Authenticate.php
View file @
0938024b
...
...
@@ -2,29 +2,18 @@
namespace
App\Http\Middleware
;
use
Closure
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Auth\Middleware\Authenticate
as
Middleware
;
class
Authenticate
class
Authenticate
extends
Middleware
{
/**
*
Handle an incoming request
.
*
Get the path the user should be redirected to when they are not authenticated
.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
* @return string
*/
p
ublic
function
handle
(
$request
,
Closure
$next
,
$guard
=
null
)
p
rotected
function
redirectTo
(
$request
)
{
if
(
Auth
::
guard
(
$guard
)
->
guest
())
{
if
(
$request
->
ajax
()
||
$request
->
wantsJson
())
{
return
response
(
'Unauthorized.'
,
401
);
}
else
{
return
redirect
()
->
guest
(
'login'
);
}
}
return
$next
(
$request
);
return
route
(
'login'
);
}
}
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