示例#1
0
 /**
  * Adds authenticated user data to the session
  */
 public function login($data = [])
 {
     $this->reset();
     $this->session->set($this->key . ".info.last_active", time());
     $this->session->set($this->key . ".info.login_time", time());
     $this->session->set($this->key . ".info.login_hash", $this->unique);
     if (!empty($data) && is_array($data)) {
         if (empty($data["image"]) && !empty($data["email"])) {
             $data["image"] = Utils::gravatar($data["email"]);
         }
         if (!empty($data["options"]) && is_string($data["options"])) {
             $data["options"] = @json_decode($data["options"], true);
         }
         $this->session->set($this->key . ".user", $data);
     }
     return true;
 }