diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 3b281d488..cea413031 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -299,6 +299,34 @@ class ConfigController extends Controller return $this->redirect($this->generateUrl('config') . '#set2'); } + /** + * @param Request $request + * + * @Route("/revoke-token", name="revoke_token") + * + * @return RedirectResponse|JsonResponse + */ + public function revokeTokenAction(Request $request) + { + $config = $this->getConfig(); + $config->setFeedToken(null); + + $em = $this->getDoctrine()->getManager(); + $em->persist($config); + $em->flush(); + + if ($request->isXmlHttpRequest()) { + return new JsonResponse(); + } + + $this->addFlash( + 'notice', + 'flashes.config.notice.feed_token_revoked' + ); + + return $this->redirect($this->generateUrl('config') . '#set2'); + } + /** * Deletes a tagging rule and redirect to the config homepage. * diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index e04c2ff1c..330b27559 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -91,6 +91,7 @@ config: no_token: 'Intet token' token_create: 'Opret token' token_reset: 'Nulstil token' + # token_revoke: 'Revoke the token' feed_links: 'RSS-Links' feed_link: unread: 'Ulæst' @@ -593,6 +594,7 @@ flashes: # tagging_rules_updated: 'Tagging rules updated' # tagging_rules_deleted: 'Tagging rule deleted' # feed_token_updated: 'RSS token updated' + # feed_token_revoked: 'RSS token revoked' # annotations_reset: Annotations reset # tags_reset: Tags reset # entries_reset: Entries reset diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 5a9668a9a..6f81dc9aa 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -91,6 +91,7 @@ config: no_token: 'Kein Token' token_create: 'Token erstellen' token_reset: 'Token zurücksetzen' + # token_revoke: 'Revoke the token' feed_links: 'RSS-Links' feed_link: unread: 'Ungelesene' @@ -584,6 +585,7 @@ flashes: tagging_rules_updated: 'Tagging-Regeln aktualisiert' tagging_rules_deleted: 'Tagging-Regel gelöscht' feed_token_updated: 'RSS-Token aktualisiert' + # feed_token_revoked: 'RSS token revoked' annotations_reset: Anmerkungen zurücksetzen tags_reset: Tags zurücksetzen entries_reset: Einträge zurücksetzen diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index e2994f539..8533f82a9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -91,6 +91,7 @@ config: no_token: 'No token' token_create: 'Create your token' token_reset: 'Regenerate your token' + token_revoke: 'Revoke the token' feed_links: 'Feed links' feed_link: unread: 'Unread' @@ -593,6 +594,7 @@ flashes: tagging_rules_updated: 'Tagging rules updated' tagging_rules_deleted: 'Tagging rule deleted' feed_token_updated: 'Feed token updated' + feed_token_revoked: 'RSS token revoked' annotations_reset: Annotations reset tags_reset: Tags reset entries_reset: Entries reset diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index d1ccfc81f..51f3d69d0 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -91,6 +91,7 @@ config: no_token: 'Sin token' token_create: 'Crear token' token_reset: 'Reiniciar token' + # token_revoke: 'Revoke the token' feed_links: 'URLs de feeds RSS' feed_link: unread: 'sin leer' @@ -593,6 +594,7 @@ flashes: tagging_rules_updated: 'Regla de etiquetado actualizada' tagging_rules_deleted: 'Regla de etiquetado eliminada' feed_token_updated: 'Token RSS actualizado' + # feed_token_revoked: 'RSS token revoked' annotations_reset: Anotaciones reiniciadas tags_reset: Etiquetas reiniciadas entries_reset: Artículos reiniciados diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index e5d36bd33..6a9cd09b7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -91,6 +91,7 @@ config: no_token: 'بدون کد' token_create: 'کد خود را بسازید' token_reset: 'بازنشانی کد' + # token_revoke: 'Revoke the token' feed_links: 'پیوند آر-اس-اس' feed_link: unread: 'خوانده‌نشده' @@ -593,6 +594,7 @@ flashes: tagging_rules_updated: 'برچسب‌گذاری خودکار به‌روز شد' tagging_rules_deleted: 'قانون برچسب‌گذاری پاک شد' feed_token_updated: 'کد آر-اس-اس به‌روز شد' + # feed_token_revoked: 'RSS token revoked' # annotations_reset: Annotations reset # tags_reset: Tags reset # entries_reset: Entries reset diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 0b1853a4e..0367ec480 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -91,6 +91,7 @@ config: no_token: "Aucun jeton généré" token_create: "Créez votre jeton" token_reset: "Réinitialisez votre jeton" + token_revoke: 'Supprimer le jeton' feed_links: "Adresses de vos flux" feed_link: unread: "Non lus" @@ -594,6 +595,7 @@ flashes: tagging_rules_updated: "Règles mises à jour" tagging_rules_deleted: "Règle supprimée" feed_token_updated: "Jeton des flux mis à jour" + feed_token_revoked: 'Jeton des flux supprimé' annotations_reset: "Annotations supprimées" tags_reset: "Tags supprimés" entries_reset: "Articles supprimés" diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 0474d2bc6..02a6145c8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -91,6 +91,7 @@ config: no_token: 'Nessun token' token_create: 'Crea il tuo token' token_reset: 'Rigenera il tuo token' + # token_revoke: 'Revoke the token' feed_links: 'Collegamenti RSS' feed_link: unread: 'Non letti' @@ -592,6 +593,7 @@ flashes: tagging_rules_updated: 'Regole di etichettatura aggiornate' tagging_rules_deleted: 'Regola di etichettatura eliminate' feed_token_updated: 'RSS token aggiornato' + # feed_token_revoked: 'RSS token revoked' annotations_reset: Reset annotazioni tags_reset: Reset etichette entries_reset: Reset articoli diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index e761832e2..aadc83582 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -91,6 +91,7 @@ config: no_token: 'Pas cap de geton generat' token_create: 'Creatz vòstre geton' token_reset: 'Reïnicializatz vòstre geton' + # token_revoke: 'Revoke the token' feed_links: 'URLs de vòstres fluxes RSS' feed_link: unread: 'Pas legits' @@ -592,6 +593,7 @@ flashes: tagging_rules_updated: 'Règlas misa a jorn' tagging_rules_deleted: 'Règla suprimida' feed_token_updated: 'Geton RSS mes a jorn' + # feed_token_revoked: 'RSS token revoked' annotations_reset: Anotacions levadas tags_reset: Etiquetas levadas entries_reset: Articles levats diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index f3d506e55..780251d87 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -91,6 +91,7 @@ config: no_token: 'Brak tokena' token_create: 'Stwórz tokena' token_reset: 'Zresetuj swojego tokena' + # token_revoke: 'Revoke the token' feed_links: 'RSS links' feed_link: unread: 'Nieprzeczytane' @@ -592,6 +593,7 @@ flashes: tagging_rules_updated: 'Reguły tagowania zaktualizowane' tagging_rules_deleted: 'Reguła tagowania usunięta' feed_token_updated: 'Token kanału RSS zaktualizowany' + # feed_token_revoked: 'RSS token revoked' annotations_reset: Zresetuj adnotacje tags_reset: Zresetuj tagi entries_reset: Zresetuj wpisy diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 6ddc1fc1f..e811c8215 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml @@ -91,6 +91,7 @@ config: no_token: 'Nenhum Token' token_create: 'Criar seu token' token_reset: 'Gerar novamente seu token' + # token_revoke: 'Revoke the token' feed_links: 'Links RSS' feed_link: unread: 'Não lido' @@ -592,6 +593,7 @@ flashes: tagging_rules_updated: 'Regras de tags atualizadas' tagging_rules_deleted: 'Regra de tag apagada' feed_token_updated: 'Token RSS atualizado' + # feed_token_revoked: 'RSS token revoked' # annotations_reset: Annotations reset # tags_reset: Tags reset # entries_reset: Entries reset diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 8c0791f0b..4e2067d37 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -91,6 +91,7 @@ config: no_token: 'Fără token' token_create: 'Crează-ți token' token_reset: 'Resetează-ți token-ul' + # token_revoke: 'Revoke the token' feed_links: 'Link-uri RSS' feed_link: unread: 'Unread' @@ -592,6 +593,7 @@ flashes: # tagging_rules_updated: 'Tagging rules updated' # tagging_rules_deleted: 'Tagging rule deleted' # feed_token_updated: 'RSS token updated' + # feed_token_revoked: 'RSS token revoked' # annotations_reset: Annotations reset # tags_reset: Tags reset # entries_reset: Entries reset diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml index 2ee2d83ab..d1040a6b6 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml @@ -89,6 +89,7 @@ config: no_token: 'Ключ не задан' token_create: 'Создать ключ' token_reset: 'Пересоздать ключ' + # token_revoke: 'Revoke the token' feed_links: 'ссылка на RSS' feed_link: unread: 'непрочитанные' @@ -558,6 +559,7 @@ flashes: tagging_rules_updated: 'Правила тегировния обновлены' tagging_rules_deleted: 'Правила тегировния удалены' feed_token_updated: 'RSS ключ обновлен' + # feed_token_revoked: 'RSS token revoked' annotations_reset: "Аннотации сброшены" tags_reset: "Теги сброшены" entries_reset: "Записи сброшены" diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml index 967ae427d..bf2bd1f50 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml @@ -91,6 +91,7 @@ config: no_token: 'ไม่มีเครื่องหมาย' token_create: 'สร้างเครื่องหมาย' token_reset: 'ทำเครื่องหมาย' + # token_revoke: 'Revoke the token' feed_links: 'ลิงค์ RSS' feed_link: unread: 'ยังไมได้่อ่าน' @@ -590,6 +591,7 @@ flashes: tagging_rules_updated: 'อัปเดตการแท็กข้อบังคับ' tagging_rules_deleted: 'การลบข้อบังคับของแท็ก' feed_token_updated: 'อัปเดตเครื่องหมาย RSS ' + # feed_token_revoked: 'RSS token revoked' annotations_reset: รีเซ็ตหมายเหตุ tags_reset: รีเซ็ตแท็ก entries_reset: รีเซ็ตรายการ diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 2f86f25d7..93fb6ca1c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -91,6 +91,7 @@ config: no_token: 'Belirteç (token) yok' token_create: 'Yeni belirteç (token) oluştur' token_reset: 'Belirteci (token) sıfırla' + # token_revoke: 'Revoke the token' feed_links: 'RSS akış bağlantıları' feed_link: unread: 'Okunmayan' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index 4ef6ab3cc..a1caf2422 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig @@ -111,14 +111,14 @@ {% else %} {{ 'config.form_feed.no_token'|trans }} {% endif %} - – - - {% if feed.token %} - {{ 'config.form_feed.token_reset'|trans }} - {% else %} - {{ 'config.form_feed.token_create'|trans }} - {% endif %} - + + {% if feed.token %} + – {{ 'config.form_feed.token_reset'|trans }} + – {{ 'config.form_feed.token_revoke'|trans }} + {% else %} + – {{ 'config.form_feed.token_create'|trans }} + {% endif %} + diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index 818fc4e71..a48c9e28a 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig @@ -140,12 +140,13 @@ {% else %} {{ 'config.form_feed.no_token'|trans }} {% endif %} - – + {% if feed.token %} - {{ 'config.form_feed.token_reset'|trans }} + – {{ 'config.form_feed.token_reset'|trans }} + – {{ 'config.form_feed.token_revoke'|trans }} {% else %} - {{ 'config.form_feed.token_create'|trans }} - {% endif %} + – {{ 'config.form_feed.token_create'|trans }} + {% endif %} diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index d8478ce3e..b9e0bed25 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -330,7 +330,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); - $this->assertNotContains('config.form_feed.no_token', $body[0]); + $this->assertContains('config.form_feed.token_reset', $body[0]); } public function testGenerateTokenAjax() @@ -351,6 +351,22 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertArrayHasKey('token', $content); } + public function testRevokeTokenAjax() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $client->request( + 'GET', + '/revoke-token', + [], + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest'] + ); + + $this->assertSame(200, $client->getResponse()->getStatusCode()); + } + public function testFeedUpdate() { $this->logInAs('admin');