Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58f68f4

Browse filesBrowse files
committed
change Parent Exception
clear old getMessage function
1 parent da90fe7 commit 58f68f4
Copy full SHA for 58f68f4

File tree

2 files changed

+5
-13
lines changed
Filter options

2 files changed

+5
-13
lines changed

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,8 @@ public function testFormLoginWithInvalidCsrfToken($options)
7373
$form['user_login[_token]'] = '';
7474
$client->submit($form);
7575

76-
$this->assertRedirect($client->getResponse(), '/login');
77-
78-
$text = $client->followRedirect()->text(null, true);
79-
$this->assertStringContainsString('Invalid CSRF token.', $text);
80-
81-
$this->callInRequestContext($client, function () {
82-
$this->assertTrue(static::getContainer()->get('security.csrf.token_storage')->hasToken('foo'));
83-
});
76+
$this->assertEquals(400, $client->getResponse()->getStatusCode());
77+
$this->assertStringContainsString('400 Bad Request', $client->getResponse()->getContent());
8478
}
8579

8680
/**

‎src/Symfony/Component/Security/Core/Exception/InvalidCsrfTokenException.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Exception/InvalidCsrfTokenException.php
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111

1212
namespace Symfony\Component\Security\Core\Exception;
1313

14+
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
15+
1416
/**
1517
* This exception is thrown when the csrf token is invalid.
1618
*
1719
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
1820
* @author Alexander <iam.asm89@gmail.com>
1921
*/
20-
class InvalidCsrfTokenException extends AuthenticationException
22+
class InvalidCsrfTokenException extends BadRequestHttpException
2123
{
22-
public function getMessageKey(): string
23-
{
24-
return 'Invalid CSRF token.';
25-
}
2624
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.