-
-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #985 [make:auth] fix security controller attributes (jrushlow)
This PR was merged into the 1.0-dev branch. Discussion ---------- [make:auth] fix security controller attributes fixes #981 Commits ------- cc71c7a [make:auth] fix security controller attributes
- Loading branch information
Showing
11 changed files
with
205 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...rity/fixtures/expected/legacy_add_login_logout_method/SecurityController_login_logout.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; | ||
|
||
class SecurityController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/login", name="app_login") | ||
*/ | ||
public function login(AuthenticationUtils $authenticationUtils): Response | ||
{ | ||
// if ($this->getUser()) { | ||
// return $this->redirectToRoute('target_path'); | ||
// } | ||
|
||
// get the login error if there is one | ||
$error = $authenticationUtils->getLastAuthenticationError(); | ||
// last username entered by the user | ||
$lastUsername = $authenticationUtils->getLastUsername(); | ||
|
||
return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]); | ||
} | ||
|
||
/** | ||
* @Route("/logout", name="app_logout") | ||
*/ | ||
public function logout(): void | ||
{ | ||
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.'); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
tests/Security/fixtures/expected/legacy_add_login_method/SecurityController_login.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; | ||
|
||
class SecurityController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/login", name="app_login") | ||
*/ | ||
public function login(AuthenticationUtils $authenticationUtils): Response | ||
{ | ||
// if ($this->getUser()) { | ||
// return $this->redirectToRoute('target_path'); | ||
// } | ||
|
||
// get the login error if there is one | ||
$error = $authenticationUtils->getLastAuthenticationError(); | ||
// last username entered by the user | ||
$lastUsername = $authenticationUtils->getLastUsername(); | ||
|
||
return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/Security/fixtures/expected/legacy_add_logout_method/SecurityController_logout.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
class SecurityController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/logout", name="app_logout") | ||
*/ | ||
public function logout(): void | ||
{ | ||
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.'); | ||
} | ||
} |