webcron/src/Controller/SecurityController.php

37 lines
1.0 KiB
PHP
Raw Normal View History

2021-04-06 19:33:20 +02:00
<?php
2022-04-27 14:24:48 +02:00
namespace App\Controller;
2021-04-06 19:33:20 +02:00
2022-04-27 14:24:48 +02:00
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2021-04-06 19:33:20 +02:00
use Symfony\Component\HttpFoundation\Response;
2022-04-27 14:24:48 +02:00
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
2021-04-06 19:33:20 +02:00
2022-04-27 14:24:48 +02:00
class SecurityController extends AbstractController
2021-04-06 19:33:20 +02:00
{
2022-04-27 14:24:48 +02:00
public function loginAction(AuthenticationUtils $authenticationUtils): Response
2021-04-06 19:33:20 +02:00
{
2022-04-27 14:24:48 +02:00
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/login.html.twig', [
'controller_name' => 'LoginController',
'last_username' => $lastUsername,
'error' => $error
]);
2021-04-06 19:33:20 +02:00
}
2021-04-07 13:31:57 +02:00
2022-04-27 14:24:48 +02:00
public function logoutAction(): void
2021-04-09 15:14:35 +02:00
{
2022-04-27 14:24:48 +02:00
// controller can be blank: it will never be called!
throw new \Exception('Don\'t forget to activate logout in security.yaml');
2021-04-09 15:14:35 +02:00
}
2021-04-07 13:31:57 +02:00
public function loginCheckAction(): Response
{
2021-04-09 15:14:35 +02:00
2021-04-07 13:31:57 +02:00
}
2021-04-06 19:33:20 +02:00
}