Added Auth::remember method for conveniently logging in users after a fresh registration.

This commit is contained in:
Taylor Otwell 2011-08-11 13:44:13 -05:00
parent 995310d62f
commit 982789a320
1 changed files with 18 additions and 3 deletions

View File

@ -96,9 +96,7 @@ public static function login($username, $password)
{
if (Hash::check($password, $user->password))
{
static::$user = $user;
Session::put(static::$key, $user->id);
static::remember($user);
return true;
}
@ -107,6 +105,23 @@ public static function login($username, $password)
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.
*