<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use App\Repository\CompanyRepository;
use Symfony\Component\HttpFoundation\Request;
use App\Entity\Company;
use App\Utils\UserManageHelper;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Contracts\Translation\TranslatorInterface;
use App\Entity\User;
use App\Utils\MailSpool;
use Doctrine\ORM\EntityManagerInterface;
use App\Repository\CompanySettingsRepository;
use App\Entity\CompanySettings;
use App\Entity\TcUserType;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use App\Entity\CompanyUser;
use App\Utils\LtsUtils;
class SecurityController extends AbstractController
{
private $CompanyRepository;
private $translator;
private $mailSpool;
private $em;
private $passwordHasher;
/**
* @var Container
*/
public $container;
public function __construct(CompanyRepository $CompanyRepository, MailSpool $mailSpool, EntityManagerInterface $entityManager, TranslatorInterface $translator, UserPasswordHasherInterface $passwordHasher)
{
$this->em = $entityManager;
$this->CompanyRepository = $CompanyRepository;
$this->translator = $translator;
$this->passwordHasher = $passwordHasher;
}
/**
* @Route("/login", name="app_login")
* User login
* @param AuthenticationUtils $authenticationUtils
* @return
*/
public function login(AuthenticationUtils $authenticationUtils): Response
{
if ($this->getUser()) {
return $this->redirectToRoute('board_view', ["boardIdentifier" => '0']);
}
$error = $authenticationUtils->getLastAuthenticationError();
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/signin.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
}
/**
* @Route("/logout", name="app_logouts")
*/
public function logout()
{
//throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}