Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Yeray Santana Hualde
syncEnrollments
Commits
8414d45c
Commit
8414d45c
authored
Dec 03, 2015
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update middleware and config
parent
4eb28ba0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
66 deletions
+53
-66
Authenticate.php
app/Http/Middleware/Authenticate.php
+2
-20
RedirectIfAuthenticated.php
app/Http/Middleware/RedirectIfAuthenticated.php
+2
-20
auth.php
config/auth.php
+49
-26
No files found.
app/Http/Middleware/Authenticate.php
View file @
8414d45c
...
@@ -3,28 +3,10 @@
...
@@ -3,28 +3,10 @@
namespace
App\Http\Middleware
;
namespace
App\Http\Middleware
;
use
Closure
;
use
Closure
;
use
Illuminate\
Contracts\Auth\Guard
;
use
Illuminate\
Support\Facades\Auth
;
class
Authenticate
class
Authenticate
{
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected
$auth
;
/**
* Create a new filter instance.
*
* @param Guard $auth
* @return void
*/
public
function
__construct
(
Guard
$auth
)
{
$this
->
auth
=
$auth
;
}
/**
/**
* Handle an incoming request.
* Handle an incoming request.
*
*
...
@@ -34,7 +16,7 @@ class Authenticate
...
@@ -34,7 +16,7 @@ class Authenticate
*/
*/
public
function
handle
(
$request
,
Closure
$next
)
public
function
handle
(
$request
,
Closure
$next
)
{
{
if
(
$this
->
auth
->
guest
())
{
if
(
Auth
::
guest
())
{
if
(
$request
->
ajax
())
{
if
(
$request
->
ajax
())
{
return
response
(
'Unauthorized.'
,
401
);
return
response
(
'Unauthorized.'
,
401
);
}
else
{
}
else
{
...
...
app/Http/Middleware/RedirectIfAuthenticated.php
View file @
8414d45c
...
@@ -3,28 +3,10 @@
...
@@ -3,28 +3,10 @@
namespace
App\Http\Middleware
;
namespace
App\Http\Middleware
;
use
Closure
;
use
Closure
;
use
Illuminate\
Contracts\Auth\Guard
;
use
Illuminate\
Support\Facades\Auth
;
class
RedirectIfAuthenticated
class
RedirectIfAuthenticated
{
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected
$auth
;
/**
* Create a new filter instance.
*
* @param Guard $auth
* @return void
*/
public
function
__construct
(
Guard
$auth
)
{
$this
->
auth
=
$auth
;
}
/**
/**
* Handle an incoming request.
* Handle an incoming request.
*
*
...
@@ -34,7 +16,7 @@ class RedirectIfAuthenticated
...
@@ -34,7 +16,7 @@ class RedirectIfAuthenticated
*/
*/
public
function
handle
(
$request
,
Closure
$next
)
public
function
handle
(
$request
,
Closure
$next
)
{
{
if
(
$this
->
auth
->
check
())
{
if
(
Auth
::
check
())
{
return
redirect
(
'/home'
);
return
redirect
(
'/home'
);
}
}
...
...
config/auth.php
View file @
8414d45c
...
@@ -4,44 +4,58 @@ return [
...
@@ -4,44 +4,58 @@ return [
/*
/*
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
|
Default Authentication Driver
|
Authentication Drivers
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
|
|
|
This option controls the authentication driver that will be utilized
.
|
Here you may define every authentication driver for your application
.
|
This driver manages the retrieval and authentication of the users
|
Of course, a default and working configuration is already defined
|
attempting to get access to protected areas of your application
.
|
here but you are free to define additional drivers when needed
.
|
|
| Supported: "database", "eloquent"
| The "guard" option defines the default driver that will be used when
| utilizing the "Auth" facade within your application. But, you may
| access every other auth driver via the facade's "guard" method.
|
|
*/
| All authentication drivers have a "provider". A provider defines how
| users are actually retrieved out of the database or other storage
'driver'
=>
'eloquent'
,
| mechanism used by your application to persist your user's data.
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
|
| When using the "Eloquent" authentication driver, we need to know which
| Supported: "session"
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
|
*/
*/
'model'
=>
App\User
::
class
,
'guard'
=>
'session'
,
'guards'
=>
[
'session'
=>
[
'driver'
=>
'session'
,
'provider'
=>
'eloquent'
,
],
],
/*
/*
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
|
Authentication Table
|
User Providers
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
|
|
| When using the "Database" authentication driver, we need to know which
| All authentication drivers have a "provider". A provider defines how
| table should be used to retrieve your users. We have chosen a basic
| users are actually retrieved out of the database or other storage
| default value but you may easily change it to any table you like.
| mechanism used by your application to persist your user's data.
|
| Supported: "database", "eloquent"
|
|
*/
*/
'providers'
=>
[
'eloquent'
=>
[
'driver'
=>
'eloquent'
,
'model'
=>
App\User
::
class
,
],
'database'
=>
[
'driver'
=>
'database'
,
'table'
=>
'users'
,
'table'
=>
'users'
,
],
],
/*
/*
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
...
@@ -52,16 +66,25 @@ return [
...
@@ -52,16 +66,25 @@ return [
| that is your password reset e-mail. You can also set the name of the
| that is your password reset e-mail. You can also set the name of the
| table that maintains all of the reset tokens for your application.
| table that maintains all of the reset tokens for your application.
|
|
| Of course, you may define multiple password "brokers" each with a their
| own storage settings and user providers. However, for most apps this
| default configuration of using Eloquent is perfect out of the box.
|
| The expire time is the number of minutes that the reset token should be
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
| they have less time to be guessed. You may change this as needed.
|
|
*/
*/
'password'
=>
[
'broker'
=>
'default'
,
'brokers'
=>
[
'default'
=>
[
'provider'
=>
'eloquent'
,
'email'
=>
'emails.password'
,
'email'
=>
'emails.password'
,
'table'
=>
'password_resets'
,
'table'
=>
'password_resets'
,
'expire'
=>
60
,
'expire'
=>
60
,
],
],
],
];
];
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