вот мой метод инициализации в AppController
public function initialize()
{
$this->log('called', LOG_DEBUG);
$this->loadComponent('Flash');
$this->loadComponent('Auth', [
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'email',
'password' => 'password'
],
'userModel' => 'Users'
]
],
'authError' => 'Did you really think you are allowed to see that?',
'storage' => 'Session',
'loginAction' => [
'controller' => 'Users',
'action' => 'login'
]
]);
$this->Auth->allow();
}
вот мой метод входа
public function login()
{
$this->log($this->request->getBody(), LOG_DEBUG);
try {
if ($this->request->is('post')) {
$user = $this->Auth->identify();
if ($user) {
$this->log('valid','debug');
$this->Auth->setUser($user);
}else{
$this->log('invalid','debug');
}
}
} catch (Exception $e) {
$this->log($e, LOG_DEBUG);
}
}
вот мой почтовый запрос из логина при входе в систему
{ "Имя пользователя": "test@test.com", "пароль": "Test @ 123"}