src/Controller/SecurityController.php line 52

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. use App\Repository\CompanyRepository;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use App\Entity\Company;
  10. use App\Utils\UserManageHelper;
  11. use Symfony\Component\HttpFoundation\JsonResponse;
  12. use Symfony\Contracts\Translation\TranslatorInterface;
  13. use App\Entity\User;
  14. use App\Utils\MailSpool;
  15. use Doctrine\ORM\EntityManagerInterface;
  16. use App\Repository\CompanySettingsRepository;
  17. use App\Entity\CompanySettings;
  18. use App\Entity\TcUserType;
  19. use Symfony\Component\DependencyInjection\ContainerInterface;
  20. use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
  21. use App\Entity\CompanyUser;
  22. use App\Utils\LtsUtils;
  23. class SecurityController extends AbstractController
  24. {
  25.     private $CompanyRepository;
  26.     private $translator;
  27.     private $mailSpool;
  28.     private $em;
  29.     private $passwordHasher;
  30.     /**
  31.      * @var Container
  32.      */
  33.     public $container;
  34.     public function __construct(CompanyRepository $CompanyRepositoryMailSpool $mailSpoolEntityManagerInterface $entityManagerTranslatorInterface $translatorUserPasswordHasherInterface $passwordHasher)
  35.     {
  36.         $this->em $entityManager;
  37.         $this->CompanyRepository $CompanyRepository;
  38.         $this->translator $translator;
  39.         $this->passwordHasher $passwordHasher;
  40.     }
  41.     /**
  42.      * @Route("/login", name="app_login")
  43.      * User login 
  44.      * @param AuthenticationUtils $authenticationUtils
  45.      * @return 
  46.      */
  47.     public function login(AuthenticationUtils $authenticationUtils): Response
  48.     {
  49.         
  50.        if ($this->getUser()) {
  51.             return $this->redirectToRoute('board_view', ["boardIdentifier" => '0']);
  52.         }
  53.         $error $authenticationUtils->getLastAuthenticationError();
  54.         $lastUsername $authenticationUtils->getLastUsername();
  55.         return $this->render('security/signin.html.twig', ['last_username' => $lastUsername'error' => $error]);
  56.     }
  57.     /**
  58.      * @Route("/logout", name="app_logouts")
  59.      */
  60.     public function logout()
  61.     {
  62.         //throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  63.     }
  64.     
  65. }