/** * Fetch user information (not using Model) * * @access protected * @param array $result * @return bool */ protected function fetch_user($result) { if (null === $result or $result->count() < 1) { return $this->reset(); } $user = $result->current(); if (!in_array($user->status, $this->allowed_status)) { // only verified user can login to this application return $this->reset(); } // we validate the hash to add security to this application $hash = $user->user_name . $user->password_token; if ($this->verify_user_agent) { $hash .= Input::user_agent(); } // validate our hash data if (null !== $this->data['_hash'] and $this->data['_hash'] !== Auth::create_hash($hash)) { return $this->reset(); } // user_id property wouldn't be available if we don't use meta or auth if (!$this->use_meta and !$this->use_auth) { $this->data['id'] = $user->id; } else { $user_id_field = Inflector::singularize($this->tables['user']) . '_id'; $this->data['id'] = $user->{$user_id_field}; } $user_name = Arr::get($this->aliases, 'user_name', 'user_name'); $email = Arr::get($this->aliases, 'email', 'email'); $this->data[$user_name] = $user->{$user_name}; $this->data[$email] = $user->{$email}; $this->data['password'] = $user->password_token; foreach ($this->optionals as $property) { if (!property_exists($user, $property)) { continue; } $this->data[$property] = $user->{$property}; } $this->cached_db_result = $result; }