|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AppBundle\Controller; |
|
4
|
|
|
|
|
5
|
|
|
use AppBundle\Entity\User; |
|
6
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; |
|
7
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
|
8
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
|
9
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
|
10
|
|
|
use Symfony\Component\HttpFoundation\RedirectResponse; |
|
11
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
12
|
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
|
13
|
|
|
|
|
14
|
|
|
class DefaultController extends Controller |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @Route("/", name="homepage") |
|
18
|
|
|
* @Template("@App/dashboard.html.twig") |
|
19
|
|
|
*/ |
|
20
|
|
|
public function indexAction() |
|
21
|
|
|
{ |
|
22
|
|
|
return []; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @Route("/login", name="login") |
|
27
|
|
|
* |
|
28
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
|
29
|
|
|
* @Method({"GET", "POST"}) |
|
30
|
|
|
*/ |
|
31
|
1 |
|
public function loginAction() |
|
32
|
|
|
{ |
|
33
|
1 |
|
$authenticationUtils = $this->get('security.authentication_utils'); |
|
34
|
1 |
|
$error = $authenticationUtils->getLastAuthenticationError(); |
|
35
|
1 |
|
$lastUsername = $authenticationUtils->getLastUsername(); |
|
36
|
|
|
|
|
37
|
1 |
|
return $this->render('@App/login.html.twig', array( |
|
38
|
1 |
|
'last_username' => $lastUsername, //$lastUsername, |
|
39
|
1 |
|
'error' => $error, |
|
40
|
|
|
)); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @Route("/logout", name="logout") |
|
45
|
|
|
*/ |
|
46
|
|
|
public function logoutAction() |
|
47
|
|
|
{ |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|