Commit 982789a3 authored by Taylor Otwell's avatar Taylor Otwell

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

parent 995310d6
...@@ -96,9 +96,7 @@ class Auth { ...@@ -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 { ...@@ -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.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment