Skip to content

Commit 4e473c0

Browse files
authored
Fixing bad logic, caused by merge originally
1 parent 9912293 commit 4e473c0

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)