Skip to content

Commit daa4847

Browse files
committed
minor #10516 Fixing bad logic, caused by merge originally (weaverryan)
This PR was merged into the 3.4 branch. Discussion ---------- Fixing bad logic, caused by merge originally Caught by @fnash in Symfony Slack! Because the `supports()` method didn't exist in 2.8, this logic basically needed to be reversed when we merged to 3.4. But, that was not done correctly (by me). Commits ------- 4e473c0 Fixing bad logic, caused by merge originally
2 parents 9912293 + 4e473c0 commit daa4847

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

security/guard_authentication.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,10 +553,8 @@ can ignore this. Here is an example of good and bad behavior::
553553

554554
public function supports(Request $request)
555555
{
556-
// GOOD behavior: only authenticate on a specific route
557-
if ($request->attributes->get('_route') !== 'login_route' || !$request->isMethod('POST')) {
558-
return true;
559-
}
556+
// GOOD behavior: only authenticate (i.e. return true) on a specific route
557+
return ($request->attributes->get('_route') === 'login_route' && $request->isMethod('POST'));
560558

561559
// e.g. your login system authenticates by the user's IP address
562560
// BAD behavior: So, you decide to *always* return true so that

0 commit comments

Comments
 (0)