diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 4360ea6b0..31b059546 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -233,12 +233,16 @@ class TagController extends AbstractController /** * Tag search results with the current search term. * - * @Route("/tag/search/{filter}", name="tag_this_search") + * @Route("/tag/search/{filter}", name="tag_this_search", methods={"POST"}) * * @return Response */ public function tagThisSearchAction($filter, Request $request, EntryRepository $entryRepository) { + if (!$this->isCsrfTokenValid('tag-this-search', $request->request->get('token'))) { + throw new BadRequestHttpException('Bad CSRF token.'); + } + $currentRoute = $request->query->has('currentRoute') ? $request->query->get('currentRoute') : ''; /** @var QueryBuilder $qb */ diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig index 93d5a82d1..95052adc6 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig @@ -46,7 +46,13 @@ {% include "@WallabagCore/Entry/_feed_link.html.twig" %} {% endif %} - {% if current_route == 'search' %}
{{ 'entry.list.assign_search_tag'|trans }}
{% endif %} + {% if current_route == 'search' %} +
+ + + +
+ {% endif %} {% if entries.getNbPages > 1 %} {{ pagerfanta(entries, 'default_wallabag') }} {% endif %} diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index f93453f26..0f28c2a1a 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php @@ -547,7 +547,7 @@ class TagControllerTest extends WallabagCoreTestCase $crawler = $client->submit($form, $data); - $client->click($crawler->selectLink('entry.list.assign_search_tag')->link()); + $client->submit($crawler->selectButton('entry.list.assign_search_tag')->form()); $client->followRedirect(); $entries = $client->getContainer()