/**
  * @param Event $event
  * @param Dispatcher $dispatcher
  * @return bool
  */
 public function beforeDispatch($event, $dispatcher)
 {
     $controller = $dispatcher->getControllerName();
     $action = $dispatcher->getActionName();
     if ($controller == 'admin' && $action == 'login') {
         return true;
     }
     if (!AdminAuthHelper::instance()->loggedIn()) {
         $dispatcher->forward(['controller' => 'admin', 'action' => 'login']);
         return false;
     }
     return true;
 }
 public function logoutAction()
 {
     AdminAuthHelper::instance()->logout();
     return $this->response->redirect(['for' => 'admin']);
 }