Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
c937f98b
Commit
c937f98b
authored
Jul 19, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #932 from JeffreyWay/feature/auth_attempt_extend
Extend Auth::Attempt()
parents
19c64f1e
c659a926
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
16 deletions
+29
-16
laravel/auth/drivers/eloquent.php
+13
-7
laravel/auth/drivers/fluent.php
+16
-9
No files found.
laravel/auth/drivers/eloquent.php
View file @
c937f98b
...
@@ -21,17 +21,24 @@ class Eloquent extends Driver {
...
@@ -21,17 +21,24 @@ class Eloquent extends Driver {
/**
/**
* Attempt to log a user into the application.
* Attempt to log a user into the application.
*
*
* @param array
$arguments
* @param array $arguments
* @return void
* @return void
*/
*/
public
function
attempt
(
$arguments
=
array
())
public
function
attempt
(
$arguments
=
array
())
{
{
$username
=
Config
::
get
(
'auth.username'
);
$user
=
$this
->
model
()
->
where
(
function
(
$query
)
use
(
$arguments
)
{
$username
=
Config
::
get
(
'auth.username'
);
$query
->
where
(
$username
,
'='
,
$arguments
[
'username'
]);
$user
=
$this
->
model
()
->
where
(
$username
,
'='
,
$arguments
[
'username'
])
->
first
();
foreach
(
array_except
(
$arguments
,
array
(
'username'
,
'password'
,
'remember'
))
as
$column
=>
$val
)
{
$query
->
where
(
$column
,
'='
,
$val
);
}
})
->
first
();
// This driver uses a basic username and password authentication scheme
// If the credentials match what is in the database we will just
// so if the credentials match what is in the database we will just
// log the user into the application and remember them if asked.
// log the user into the application and remember them if asked.
$password
=
$arguments
[
'password'
];
$password
=
$arguments
[
'password'
];
...
@@ -57,4 +64,4 @@ class Eloquent extends Driver {
...
@@ -57,4 +64,4 @@ class Eloquent extends Driver {
return
new
$model
;
return
new
$model
;
}
}
}
}
\ No newline at end of file
laravel/auth/drivers/fluent.php
View file @
c937f98b
...
@@ -25,15 +25,14 @@ class Fluent extends Driver {
...
@@ -25,15 +25,14 @@ class Fluent extends Driver {
/**
/**
* Attempt to log a user into the application.
* Attempt to log a user into the application.
*
*
* @param array
$arguments
* @param array $arguments
* @return void
* @return void
*/
*/
public
function
attempt
(
$arguments
=
array
())
public
function
attempt
(
$arguments
=
array
())
{
{
$user
=
$this
->
get_user
(
$arguments
[
'username'
]
);
$user
=
$this
->
get_user
(
$arguments
);
// This driver uses a basic username and password authentication scheme
// If the credentials match what is in the database we will just
// so if the credentials match what is in the database we will just
// log the user into the application and remember them if asked.
// log the user into the application and remember them if asked.
$password
=
$arguments
[
'password'
];
$password
=
$arguments
[
'password'
];
...
@@ -48,18 +47,26 @@ class Fluent extends Driver {
...
@@ -48,18 +47,26 @@ class Fluent extends Driver {
}
}
/**
/**
* Get the user from the database table
by username
.
* Get the user from the database table.
*
*
* @param
mixed $value
* @param
array $arguments
* @return mixed
* @return mixed
*/
*/
protected
function
get_user
(
$
value
)
protected
function
get_user
(
$
arguments
)
{
{
$table
=
Config
::
get
(
'auth.table'
);
$table
=
Config
::
get
(
'auth.table'
);
$username
=
Config
::
get
(
'auth.username'
);
return
DB
::
table
(
$table
)
->
where
(
function
(
$query
)
use
(
$arguments
)
{
$username
=
Config
::
get
(
'auth.username'
);
$query
->
where
(
$username
,
'='
,
$arguments
[
'username'
]);
return
DB
::
table
(
$table
)
->
where
(
$username
,
'='
,
$value
)
->
first
();
foreach
(
array_except
(
$arguments
,
array
(
'username'
,
'password'
,
'remember'
))
as
$column
=>
$val
)
{
$query
->
where
(
$column
,
'='
,
$val
);
}
})
->
first
();
}
}
}
}
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