Added comments and changed the $cookie var to use implode.

This commit is contained in:
Eric Barnes 2011-10-09 12:05:12 -04:00
parent 3d2aa29d44
commit 560a4cc1c2
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}
}