[CONTROLLER][ROUTES] Refactor controllers to use the new base class and remove controller from the class name
This commit is contained in:
29
src/Controller/Security.php
Normal file
29
src/Controller/Security.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Core\Controller;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
class Security extends Controller
|
||||
{
|
||||
public function login(AuthenticationUtils $authenticationUtils): Response
|
||||
{
|
||||
if ($this->getUser()) {
|
||||
return $this->redirectToRoute('main_all');
|
||||
}
|
||||
|
||||
// get the login error if there is one
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
// last username entered by the user
|
||||
$last_username = $authenticationUtils->getLastUsername();
|
||||
|
||||
return ['_template' => 'security/login.html.twig', 'last_username' => $last_username, 'error' => $error];
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user