Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * SecurityController.php
- * User: draiz
- * Date: 14/06/2017
- * Time: 12:59
- */
- namespace AdminBundle\Controller;
- use AdminBundle\Form\LoginForm;
- use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
- use Symfony\Bundle\FrameworkBundle\Controller\Controller;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
- class SecurityController extends Controller
- {
- /**
- * @Route("/admin/login", name="admin_security_login")
- */
- public function loginAction(Request $request, AuthenticationUtils $authUtils)
- {
- // get the login error if there is one
- $error = $authUtils->getLastAuthenticationError();
- // last username entered by the user
- $lastUsername = $authUtils->getLastUsername();
- $form = $this->createForm(LoginForm::class, [
- '_username' => $lastUsername,
- ]);
- return $this->render(
- '@Admin/security/login.html.twig',
- array(
- 'last_username' => $lastUsername,
- 'form' => $form->createView(),
- 'error' => $error,
- )
- );
- }
- /**
- * @Route("/admin/logout", name="admin_security_logout")
- */
- public function logoutAction()
- {
- throw new \Exception('this should not be reached!');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement