Login Controller - SamuelPouzet/auth GitHub Wiki
The login needs a form, which implements SamuelPouzet\Auth\Interface\Form\AuthFormInterface
An example:
use SamuelPouzet\Auth\Service\CredentialService
public function loginAction(): ViewModel
{
$form = $this->getForm(AuthFormInterface::class);
if ($this->getRequest()->isPost()) {
$form->setData($this->params()->fromPost());
if ($form->isValid()) {
$formData = $form->getData();
$this->credentialService->authenticate($formData);
}
$this->redirect()->toRoute('home');
}
return new ViewModel(['form' => $form]);
}