I would like to reproduce the cakephp login
if I do :
$this->request->data=array('User'=>array(
'username'=>'admin',
'password'=>'123456',
));
var_dump($this->Auth->login());
var_dump( $this->Auth->user());
It's working and I get
boolean true
array (size=6)
'id' => string '2' (length=1)
'username' => string 'admin' (length=2)
etc...
But if I don't use $this->request->data
, it's not working.
According to docs: http://api.cakephp.org/2.1/class-AuthComponent.html#_login
mixed $user optional null Either an array of user data, or null to identify a user using the current request.
So if I use $user
it should work but it doesn't :
$user=array('User'=>array(
'username'=>'admin',
'password'=>'123456',
));
var_dump($this->Auth->login($user));
var_dump( $this->Auth->user());
Thanks