예제 #1
0
 /**
  * @param $name
  * @param $password
  * @return User|null
  * @throws Exception
  */
 public function auth($name, $password)
 {
     $id = $this->getIdByName($name);
     if (!$id) {
         throw new Exception("User with name {$name} not found");
     }
     $User = Kernel::getRepository(EntityType::USER)->loadById($id);
     if (password_verify($password, $User->get(User::FIELD_PASSWORD))) {
         return $User;
     }
     return null;
 }
예제 #2
0
 /**
  * @return PostRepository
  */
 protected function getRepository()
 {
     return Kernel::getRepository(EntityType::POST);
 }