When I try to login, the request gets blackholed by teh Security component. How can I make it work right?
I have a simple login form
<div class="container container-login">
<h2><?php echo __('Login'); ?></h2>
<div class="wrap-form-signin">
<?php
echo $this->Form->create('User', array('action' => 'login', 'class' => 'form-signin'));
echo $this->Form->input('username', array('label' => '', 'placeholder' => __('Email')));
echo $this->Form->input('password', array('label' => '', 'placeholder' => __('Password')));
echo $this->Form->submit(__('Login'));
echo $this->Form->end();
?>
</div>
</div>
The controller action goes like this:
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl());
} else {
$this->Session->setFlash(__('Username or password is incorrect'), 'default', array(), 'auth');
}
}
}
And the Security component is included in AppController
public $components = array('Security', ... );
In the error.log I get:
2013-03-29 13:40:58 Error: [BadRequestException] The request has been black-holed
Request URL: /users/login
Stack Trace:
#0 C:\wamp\www\cdx\lib\Cake\Controller\Component\SecurityComponent.php(234): SecurityComponent->blackHole(Object(UsersController), 'auth')
#1 [internal function]: SecurityComponent->startup(Object(UsersController))
#2 C:\wamp\www\cdx\lib\Cake\Utility\ObjectCollection.php(131): call_user_func_array(Array, Array)
#3 [internal function]: ObjectCollection->trigger(Object(CakeEvent))
#4 C:\wamp\www\cdx\lib\Cake\Event\CakeEventManager.php(247): call_user_func(Array, Object(CakeEvent))
#5 C:\wamp\www\cdx\lib\Cake\Controller\Controller.php(670): CakeEventManager->dispatch(Object(CakeEvent))
#6 C:\wamp\www\cdx\lib\Cake\Routing\Dispatcher.php(183): Controller->startupProcess()
#7 C:\wamp\www\cdx\lib\Cake\Routing\Dispatcher.php(161): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
#8 C:\wamp\www\cdx\app\webroot\index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#9 {main}
How can I find what is making my request go to black hole?
When I tried to use a custom blackhole handler, the type of the error was auth. But that's all the information I can get
My version of CakePHP is 2.3.1
EDIT:
The login works well without the Security component. After adding it to the AppController, the login stops working.
EDIT2: I don't have any data[_Token][key] fields in the form
EDIT3 THE SOLLUTION: Someone from my team has overriden the HTMLHelper class and it missed "hiddenblock" in the _tags array, which resulted in missing _Token fields. For details, see mine and thaJeztah's answers along with the comments bellow them