8000 minor #13363 Move login route to const (JakubSzczesniak) · symfony/symfony-docs@8eb21f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8eb21f4

Browse files
committed
minor #13363 Move login route to const (JakubSzczesniak)
This PR was submitted for the 5.0 branch but it was merged into the 4.4 branch instead (closes #13363). Discussion ---------- Move login route to const This is more stable solution. I spent half of hour to fix bug, because I forgot change route name in 2 places. Commits ------- 5b0a583 Update form_login_setup.rst
2 parents 2309998 + 5b0a583 commit 8eb21f4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

security/form_login_setup.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ a traditional HTML form that submits to ``/login``:
191191
class LoginFormAuthenticator extends AbstractFormLoginAuthenticator implements PasswordAuthenticatedInterface
192192
{
193193
use TargetPathTrait;
194+
195+
public const LOGIN_ROUTE = 'app_login';
194196

195197
private $entityManager;
196198
private $urlGenerator;
@@ -207,7 +209,7 @@ a traditional HTML form that submits to ``/login``:
207209

208210
public function supports(Request $request)
209211
{
210-
return 'app_login' === $request->attributes->get('_route')
212+
return self::LOGIN_ROUTE === $request->attributes->get('_route')
211213
&& $request->isMethod('POST');
212214
}
213215

@@ -260,7 +262,7 @@ a traditional HTML form that submits to ``/login``:
260262

261263
protected function getLoginUrl()
262264
{
263-
return $this->urlGenerator->generate('app_login');
265+
return $this->urlGenerator->generate(self::LOGIN_ROUTE);
264266
}
265267
}
266268

0 commit comments

Comments
 (0)
0