Alright, thanks so much for the help so far, I think I get it. Now it’s telling me that I have a CSRF mismatch when I try to log in, which I assume means I’ve put in my details incorrectly. This is what I have in my Application.php:
$service->loadIdentifier('Authentication.Password', [
'fields' => [
'username' => 'email',
'password' => 'password',
],
'resolver' => [
'className' => 'Authentication.Orm',
'userModel' => 'Accounts'
]
]);
// Load the authenticators, you want session first
$service->loadAuthenticator('Authentication.Session');
$service->loadAuthenticator('Authentication.Form', [
'fields' => [
'username' => 'email',
'password' => 'password',
],
'loginUrl' => '/client/login'
]);
I think this should work, the form is on the page client/login. This is how the form is constructed:
<form method="post">
<div class="form-group has-feedback">
<input type="email" class="form-control" placeholder="Email" name="email">
</div>
<div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Password" name="password">
</div>
<div class="row">
<!-- /.col -->
<div class="col-xs-4">
<button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
</div>
<!-- /.col -->
</div>
</form>
And this is what’s in my controller:
public function login()
{
$this->loadModel('Accounts');
if ($this->request->is(['post', 'put'])) {
$result = $this->Authentication->getResult();
Debugger::dump($result);
}
}
I’m not sure what I’m doing wrong to get this token mismatch. Thanks again for all of your help. Here’s a photo of the accounts table as well.
