src/Controller/SecurityController.php line 37

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Client;
  4. use App\Services\CallApiServices;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use KnpU\OAuth2ClientBundle\Client\ClientRegistry;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  11. class SecurityController extends AbstractController
  12. {
  13.     /**
  14.      * @Route("/login", name="app_login")
  15.      */
  16.     public function login(AuthenticationUtils $authenticationUtilsRequest $request): Response
  17.     {
  18.         $serviceId $this->getParameter('app.serviceId');
  19.         // if ($this->getUser()) {
  20.         //     return $this->redirectToRoute('target_path');
  21.         // }
  22.         // get the login error if there is one
  23.         $error $authenticationUtils->getLastAuthenticationError();
  24.         // last username entered by the user
  25.         $lastUsername $authenticationUtils->getLastUsername();
  26.         return $this->render('security/login.html.twig', ['last_username' => $lastUsername'error' => $error'serviceId' => $serviceId]);
  27.     }
  28.     /**
  29.      * @Route("/logout", name="app_logout")
  30.      */
  31.     public function logout(): void
  32.     {
  33.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  34.     }
  35.     /**
  36.      * @Route("/forgotPassword", name="app_forgotPassword")
  37.      */
  38.     public function forgotPassword(): void
  39.     {
  40.         //TODO envoyer un mail de veification pour changer le mot de passe.
  41.     }
  42. }