mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
In between commit implementation securitycontroller
This commit is contained in:
31
application/src/Controller/SecurityController.php
Normal file
31
application/src/Controller/SecurityController.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class SecurityController extends AbstractController
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @Route("/login", name="login")
|
||||
*/
|
||||
public function login(AuthenticationUtils $authenticationUtils): Response
|
||||
{
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
if ($error) {
|
||||
$this->addFlash('notice', $error);
|
||||
}
|
||||
return $this->render("user/login.html.twig",[
|
||||
'last_username'=>$authenticationUtils->getLastUsername(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ namespace App\Controller;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -12,7 +13,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
*/
|
||||
class UserController extends AbstractController implements UserControllerInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/user/logout", name="user_logout")
|
||||
*/
|
||||
public function logout(): Response
|
||||
@@ -21,14 +24,7 @@ class UserController extends AbstractController implements UserControllerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/user/login", name="user_login")
|
||||
*/
|
||||
public function login(): Response
|
||||
{
|
||||
return $this->render("user/login.html.twig");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/user/register", name="user_register")
|
||||
*/
|
||||
public function register(): Response
|
||||
|
@@ -2,6 +2,7 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -12,7 +13,5 @@ interface UserControllerInterface
|
||||
{
|
||||
public function logout():Response;
|
||||
|
||||
public function login():Response;
|
||||
|
||||
public function register():Response;
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ class UserMenuSubscriber implements EventSubscriberInterface
|
||||
$dropdown->addChild(
|
||||
'login',
|
||||
[
|
||||
'route' => 'user_login',
|
||||
'route' => 'login',
|
||||
'attributes' => [
|
||||
'divider_append' => true,
|
||||
'icon' => 'fas fa-sign-in-alt',
|
||||
|
Reference in New Issue
Block a user