From 982789a320ea577f19623bf9532bd4e1cf9b3bc5 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 11 Aug 2011 13:44:13 -0500 Subject: [PATCH] Added Auth::remember method for conveniently logging in users after a fresh registration. --- system/auth.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/system/auth.php b/system/auth.php index e7f914c8..e9734896 100644 --- a/system/auth.php +++ b/system/auth.php @@ -96,9 +96,7 @@ class Auth { { if (Hash::check($password, $user->password)) { - static::$user = $user; - - Session::put(static::$key, $user->id); + static::remember($user); return true; } @@ -107,6 +105,23 @@ class Auth { 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. *