Added Auth::remember method for conveniently logging in users after a fresh registration.
This commit is contained in:
parent
995310d62f
commit
982789a320
|
@ -96,9 +96,7 @@ public static function login($username, $password)
|
||||||
{
|
{
|
||||||
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 @@ public static function login($username, $password)
|
||||||
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.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue