From 560a4cc1c201a0f3db795caff5e7258ea9ad2cd2 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 9 Oct 2011 12:05:12 -0400 Subject: [PATCH] Added comments and changed the $cookie var to use implode. --- laravel/security/auth.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/laravel/security/auth.php b/laravel/security/auth.php index 608c5b12..98a12dda 100644 --- a/laravel/security/auth.php +++ b/laravel/security/auth.php @@ -60,7 +60,8 @@ public static function user() $id = $cookie[0]; } - if ( ! is_null(static::$user = call_user_func(Config::get('auth.user'), $id))) + // Attempt to find the user and set the login session. + if ( ! is_null($user = call_user_func(Config::get('auth.user'), $id))) { static::login($user); return static::$user; @@ -137,7 +138,7 @@ public static function logout() public static function remember($user, $ttl = 10080) { static::$user = $user; - $cookie = Crypter::encrypt($user->id.'|'.\Request::ip().'|'.md5(\Request::server('HTTP_USER_AGENT')).'|'.time()); + $cookie = Crypter::encrypt(implode('|', array($user->id, \Request::ip(), md5(\Request::server('HTTP_USER_AGENT')), time())); \Cookie::put('remember', $cookie, $ttl); } } \ No newline at end of file