i try to use Auth in cakephp3 but i got return error
i am sure that data correct
For note password field size is 255 char
sql log return only user_mail filed where
phi_members.user_mail = 'gathuth@gmail.com'
why it not include user_password !!
and row result is 1
PhimembersController.php
<?PHP
namespace App\Controller;
use App\Controller\AppController;
use Cake\Event\Event;
Class PhimembersController extends AppController {
var $name="Phi_members";
public $components = array('RequestHandler');
public function index()
{
echo'Hello World';
}
public function show() {
$this->set('phi_members',$this->Phi_members->find('all'));
}
public function initialize()
{
parent::initialize();
$this->loadComponent('Flash');
$this->loadComponent('Auth', [
'loginRedirect' => [
'action' => 'index'] , 'loginAction' => [
'action' => 'login'
],
'authenticate' => [
'Form' => [
'userModel' => 'phi_members',
'fields' => ['username' => 'user_mail','password' => 'user_password']
]
]
]);
}
public function beforeFilter(Event $event)
{
$this->Auth->allow(['index', 'login']);
}
public function login()
{
if ($this->request->is('post')) {
$user = $this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
return $this->redirect($this->Auth->redirectUrl());
}
$this->Flash->error(__('Invalid username or password, try again'));
}
}
}
?>
login.ctp
<?= $this->Flash->render('auth') ?>
<?= $this->Form->create(); ?>
<?= __('Please enter your username and password') ?>
<?= $this->Form->input('user_mail') ?>
<?= $this->Form->input('user_password') ?>
</fieldset>
<?= $this->Form->button(__('login')); ?>
<?= $this->Form->end() ?>
Any Help