| Conditions | 5 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function login(AuthenticationUtils $authenticationUtils) |
||
| 16 | { |
||
| 17 | $error = $authenticationUtils->getLastAuthenticationError(); |
||
| 18 | $lastUsername = $authenticationUtils->getLastUsername(); |
||
| 19 | $form = $this->createForm(UserLoginType::class); |
||
| 20 | |||
| 21 | if ($error) { |
||
| 22 | $error = new FormError("There is an error: " . $error->getMessage()); |
||
| 23 | $form->addError($error); |
||
| 24 | }; |
||
| 25 | |||
| 26 | if ($form->isSubmitted() && $form->isValid() && !$error) { |
||
| 27 | return $this->redirectToRoute('admin_dashboard'); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $this->render( |
||
| 31 | 'security/login.html.twig', |
||
| 32 | [ |
||
| 33 | 'form' => $form->createView(), |
||
| 34 | 'last_username' => $lastUsername, |
||
| 35 | 'error' => $error, |
||
| 36 | ] |
||
| 48 | } |