Auth_Basic::memorizeModel PHP Method

memorizeModel() public method

Store model in session data so that it can be retrieved faster.
public memorizeModel ( )
    public function memorizeModel()
    {
        if (!$this->model->loaded()) {
            throw $this->exception('Authentication failure', 'AccessDenied');
        }
        // Don't store password in model / memory / session
        $this->model['password'] = null;
        unset($this->model->dirty['password']);
        // Cache memory. Should we use controller?
        $this->info = $this->model->get();
        $this->info['username'] = $this->info[$this->login_field];
        if ($this->app->hasMethod('initializeSession') || session_id()) {
            $this->memorize('info', $this->info);
            $this->memorize('class', get_class($this->model));
            $this->memorize('id', $this->model->id);
        }
        $this->hook('login');
    }