Added comments and changed the $cookie var to use implode.
This commit is contained in:
parent
3d2aa29d44
commit
560a4cc1c2
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue