Example #1
0
 public function login($hash = false)
 {
     $this->controller->loadModel($this->config['model']);
     $data = $this->controller->request->data[$this->config['model']];
     if ($hash) {
         $password = Security::hash($data['password']);
     } else {
         $password = $data['password'];
     }
     $user = $this->controller->{$this->config['model']}->find('first')->select()->where([$this->config['fields']['username'] => $data['username'], $this->config['fields']['password'] => $password])->build();
     if (!empty($user->{$this->config['model']})) {
         $this->setUser($user->{$this->config['model']});
         return true;
     }
     return false;
 }
Example #2
0
 public static function generateKey()
 {
     return Security::hash(String::uuid());
 }