Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundle\Controller;
- use AppBundle\Form\LoginForm;
- use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
- use Symfony\Bundle\FrameworkBundle\Controller\Controller;
- class SecurityController extends Controller
- {
- /**
- * @Route("/login", name="security_login")
- */
- public function loginAction()
- {
- $authenticationUtils = $this->get('security.authentication_utils');
- // get the login error if there is one
- $error = $authenticationUtils->getLastAuthenticationError();
- // last username entered by the user
- $lastUsername = $authenticationUtils->getLastUsername();
- $form = $this->createForm(LoginForm::class, [
- '_username' => $lastUsername
- ]);
- return $this->render(
- 'security/login.html.twig',
- array(
- 'form' => $form->createView(),
- 'error' => $error,
- )
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement