src/Controller/Admin/SecurityController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Admin;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. //登陆
  8. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  9. #[Route('/admin'name'admin.')]
  10. class SecurityController extends AbstractController
  11. {
  12.     #[Route('/login'name'login'options: ['name'=>'登陆''ignore'=> true])]
  13.     public function login(AuthenticationUtils $authenticationUtilsRequest $request)
  14.     {
  15.         $error $authenticationUtils->getLastAuthenticationError();
  16.         $lastUsername $authenticationUtils->getLastUsername();
  17.         return $this->render('admin/security/login.html.twig',[
  18.             'error' => $error,
  19.             'last_username' => $lastUsername,
  20.         ]);
  21.     }
  22.     #[Route('/logout'name'logout'options: ['name'=>'退出''ignore'=> true])]
  23.     public function logout()
  24.     {
  25.         throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
  26.     }
  27.  
  28. }