Hi guys!
I creating auth technology.
<?php
class AdminController extends \Phalcon\Mvc\Controller
{
public function initialize()
{
if($this->session->get('auth')) {
return $this->dispatcher->forward(array(
'controller' => 'admin',
'action' => 'index'
));
} else {
return $this->dispatcher->forward(array(
'controller' => 'admin',
'action' => 'login'
));
}
}
public function indexAction()
{
$this->view->hello = 'Hello, ' . ADMIN_USERNAME;
}
public function loginAction()
{
if($this->request->isPost()) {
$username = $this->request->getPost('username');
$password = $this->request->getPost('password');
if($username == ADMIN_USERNAME && $password == ADMIN_PASSWORD) {
$this->session->set('auth', true);
return $this->dispatcher->forward(array(
'controller' => 'admin',
'action' => 'index'
));
}
}
}
}
and routing:
$router->add("/admin/:action/", array(
'controller' => 'admin',
'action' => 1
));
but phalcon returned "PhalconException: Dispatcher has detected a cyclic routing causing stability problems"
what am I doing wrong?
Sorry for my english:)