Completed
Pull Request — development (#795)
by Nick
04:52
created

SecurityController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A login() 0 16 1
A logout() 0 3 1
1
<?php
2
3
4
namespace Oc\Security;
5
6
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
7
use Symfony\Component\HttpFoundation\Response;
8
use Symfony\Component\Routing\Annotation\Route;
9
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
10
11
class SecurityController extends AbstractController
12
{
13
    /**
14
     * @Route("/login", name="app_login")
15
     */
16
    public function login(AuthenticationUtils $authenticationUtils): Response
17
    {
18
        // if ($this->getUser()) {
19
        //     return $this->redirectToRoute('target_path');
20
        // }
21
22
        // get the login error if there is one
23
        $error = $authenticationUtils->getLastAuthenticationError();
24
        // last username entered by the user
25
        $lastUsername = $authenticationUtils->getLastUsername();
26
27
        return $this->render('security/login.html.twig', [
28
            'last_username' => $lastUsername,
29
            'error' => $error
30
        ]);
31
    }
32
33
    /**
34
     * @Route("/logout", name="app_logout")
35
     */
36
    public function logout()
37
    {
38
    }
39
}
40