1
I’m maintaining a cakephp system but trying to log in to Brower returns the following error.
This webpage has a loop redirect
I searched the stack em ingles and found a "solution" that told me to include:
$this->Auth->allow('display');
In my class AppController within the facility beforeFilter(), This worked but now when soon in the system no menu link works.
Below the code of AppController
public $components = array(
    'Session',
    'RequestHandler',
    'Auth'=>array(
        'loginRedirect' => array('controller' => 'eventos', 'action' => 'index'),
        'loginRedirect' => array('controller' => 'pages', 'action' => 'login'),
        'logoutRedirect' => array('controller' => 'user', 'action' => 'login'),
        'authorize' => array('Controller'),
        'authError' => 'Você não tem permissão para acessar essa área!'
    ));
public $helpers = array('Html', 'Form', 'Session', 'Time', 'Text', 'Number');
public $model;
public $not_condition = array('page', 'direction', 'sort');
public $filter_with_like = array();
public $conditions = array();
public $limit = 20;
public function beforeFilter() {
    //$this->Auth->allow('display');
    $this->Auth->authError = 'Área restrita';
    $this->Auth->authorize = 'Controller';
    $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'index' );
}
The method of login:
public function login() {
    $this->layout = 'login';
    $this->Session->destroy();
    if ($this->request->is('post')) {
        $this->User->Behaviors->load('Containable');
        $this->User->recursive = -1;
        if ($this->Auth->login($this)) {
            $user = $this->User->checkIn($this->request->data['User']['user'], $this->request->data['User']['senha']); //Checa user e senha
            if ($user != false) { // Se tiver tudo ok
                $user['Admin'] = $user['User'];
                $this->Auth->login($user['User']);
                $this->Auth->login();
                $this->Session->read();
                $this->Session->write($this->Auth->sessionKey, $this->Auth->user());
                //$this->redirect($this->Auth->redirect('/' . $th   is->Auth->user('Nivel.short') . '/dashboard/'));
                $this->redirect($this->Auth->redirect(array('controller' => 'email', 'action' => 'relatorio')));
            } else {
                $this->Session->setFlash('Dados incorretos', 'login');
            }
        } else
            $this->Session->setFlash('Dados incorretos', 'login');
    }