示例#1
0
文件: Basic.php 项目: atk4/atk4
 /**
  * Store model in session data so that it can be retrieved faster.
  */
 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');
 }