Added Auth::remember method for conveniently logging in users after a fresh registration.
This commit is contained in:
@@ -96,9 +96,7 @@ class Auth {
|
|||||||
{
|
{
|
||||||
if (Hash::check($password, $user->password))
|
if (Hash::check($password, $user->password))
|
||||||
{
|
{
|
||||||
static::$user = $user;
|
static::remember($user);
|
||||||
|
|
||||||
Session::put(static::$key, $user->id);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -107,6 +105,23 @@ class Auth {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login a user without checking any credentials.
|
||||||
|
*
|
||||||
|
* This is helpful for logging in a user after a fresh registration.
|
||||||
|
*
|
||||||
|
* Note: The user given to this method should be an object having a "id" property.
|
||||||
|
*
|
||||||
|
* @param object $user
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function remember($user)
|
||||||
|
{
|
||||||
|
static::$user = $user;
|
||||||
|
|
||||||
|
Session::put(static::$key, $user->id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log the user out of the application.
|
* Log the user out of the application.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user