Laravel version update
Laravel version update
This commit is contained in:
@@ -68,12 +68,12 @@ class DatabaseUserProvider implements UserProvider
|
||||
*/
|
||||
public function retrieveByToken($identifier, $token)
|
||||
{
|
||||
$user = $this->conn->table($this->table)
|
||||
->where('id', $identifier)
|
||||
->where('remember_token', $token)
|
||||
->first();
|
||||
$user = $this->getGenericUser(
|
||||
$this->conn->table($this->table)->find($identifier)
|
||||
);
|
||||
|
||||
return $this->getGenericUser($user);
|
||||
return $user && $user->getRememberToken() && hash_equals($user->getRememberToken(), $token)
|
||||
? $user : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,8 +86,8 @@ class DatabaseUserProvider implements UserProvider
|
||||
public function updateRememberToken(UserContract $user, $token)
|
||||
{
|
||||
$this->conn->table($this->table)
|
||||
->where('id', $user->getAuthIdentifier())
|
||||
->update(['remember_token' => $token]);
|
||||
->where($user->getAuthIdentifierName(), $user->getAuthIdentifier())
|
||||
->update([$user->getRememberTokenName() => $token]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,6 +98,12 @@ class DatabaseUserProvider implements UserProvider
|
||||
*/
|
||||
public function retrieveByCredentials(array $credentials)
|
||||
{
|
||||
if (empty($credentials) ||
|
||||
(count($credentials) === 1 &&
|
||||
array_key_exists('password', $credentials))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// First we will add each credential element to the query as a where clause.
|
||||
// Then we can execute the query and, if we found a user, return it in a
|
||||
// generic "user" object that will be utilized by the Guard instances.
|
||||
@@ -125,7 +131,7 @@ class DatabaseUserProvider implements UserProvider
|
||||
*/
|
||||
protected function getGenericUser($user)
|
||||
{
|
||||
if ($user !== null) {
|
||||
if (! is_null($user)) {
|
||||
return new GenericUser((array) $user);
|
||||
}
|
||||
}
|
||||
@@ -139,8 +145,8 @@ class DatabaseUserProvider implements UserProvider
|
||||
*/
|
||||
public function validateCredentials(UserContract $user, array $credentials)
|
||||
{
|
||||
$plain = $credentials['password'];
|
||||
|
||||
return $this->hasher->check($plain, $user->getAuthPassword());
|
||||
return $this->hasher->check(
|
||||
$credentials['password'], $user->getAuthPassword()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user