mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-15 13:31:13 +00:00
Merge pull request #3994 from wallabag/feature/revoke-feed-token
Add ability to revoke feed token
This commit is contained in:
commit
2b04b300f8
18 changed files with 85 additions and 13 deletions
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -594,6 +595,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
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -585,6 +586,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
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -594,6 +595,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
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -594,6 +595,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
|
||||
|
|
|
@ -92,6 +92,7 @@ config:
|
|||
no_token: 'بدون کد'
|
||||
token_create: 'کد خود را بسازید'
|
||||
token_reset: 'بازنشانی کد'
|
||||
# token_revoke: 'Revoke the token'
|
||||
feed_links: 'پیوند آر-اس-اس'
|
||||
feed_link:
|
||||
unread: 'خواندهنشده'
|
||||
|
@ -594,6 +595,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
|
||||
|
|
|
@ -92,6 +92,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"
|
||||
|
@ -595,6 +596,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"
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -593,6 +594,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
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -593,6 +594,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
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -593,6 +594,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
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -593,6 +594,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
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
@ -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
|
||||
|
|
|
@ -91,6 +91,7 @@ config:
|
|||
no_token: 'Ключ не задан'
|
||||
token_create: 'Создать ключ'
|
||||
token_reset: 'Пересоздать ключ'
|
||||
# token_revoke: 'Revoke the token'
|
||||
feed_links: 'ссылка на RSS'
|
||||
feed_link:
|
||||
unread: 'непрочитанные'
|
||||
|
@ -560,6 +561,7 @@ flashes:
|
|||
tagging_rules_updated: 'Правила тегировния обновлены'
|
||||
tagging_rules_deleted: 'Правила тегировния удалены'
|
||||
feed_token_updated: 'RSS ключ обновлен'
|
||||
# feed_token_revoked: 'RSS token revoked'
|
||||
annotations_reset: "Аннотации сброшены"
|
||||
tags_reset: "Теги сброшены"
|
||||
entries_reset: "Записи сброшены"
|
||||
|
|
|
@ -92,6 +92,7 @@ config:
|
|||
no_token: 'ไม่มีเครื่องหมาย'
|
||||
token_create: 'สร้างเครื่องหมาย'
|
||||
token_reset: 'ทำเครื่องหมาย'
|
||||
# token_revoke: 'Revoke the token'
|
||||
feed_links: 'ลิงค์ RSS'
|
||||
feed_link:
|
||||
unread: 'ยังไมได้่อ่าน'
|
||||
|
@ -591,6 +592,7 @@ flashes:
|
|||
tagging_rules_updated: 'อัปเดตการแท็กข้อบังคับ'
|
||||
tagging_rules_deleted: 'การลบข้อบังคับของแท็ก'
|
||||
feed_token_updated: 'อัปเดตเครื่องหมาย RSS '
|
||||
# feed_token_revoked: 'RSS token revoked'
|
||||
annotations_reset: รีเซ็ตหมายเหตุ
|
||||
tags_reset: รีเซ็ตแท็ก
|
||||
entries_reset: รีเซ็ตรายการ
|
||||
|
|
|
@ -92,6 +92,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'
|
||||
|
|
|
@ -111,14 +111,14 @@
|
|||
{% else %}
|
||||
<em>{{ 'config.form_feed.no_token'|trans }}</em>
|
||||
{% endif %}
|
||||
–
|
||||
<a href="{{ path('generate_token') }}">
|
||||
{% if feed.token %}
|
||||
{{ 'config.form_feed.token_reset'|trans }}
|
||||
{% else %}
|
||||
{{ 'config.form_feed.token_create'|trans }}
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
{% if feed.token %}
|
||||
– <a href="{{ path('generate_token') }}">{{ 'config.form_feed.token_reset'|trans }}</a>
|
||||
– <a href="{{ path('revoke_token') }}">{{ 'config.form_feed.token_revoke'|trans }}</a>
|
||||
{% else %}
|
||||
– <a href="{{ path('generate_token') }}">{{ 'config.form_feed.token_create'|trans }}</a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -140,12 +140,13 @@
|
|||
{% else %}
|
||||
<em>{{ 'config.form_feed.no_token'|trans }}</em>
|
||||
{% endif %}
|
||||
– <a href="{{ path('generate_token') }}">
|
||||
|
||||
{% if feed.token %}
|
||||
{{ 'config.form_feed.token_reset'|trans }}
|
||||
– <a href="{{ path('generate_token') }}">{{ 'config.form_feed.token_reset'|trans }}</a>
|
||||
– <a href="{{ path('revoke_token') }}">{{ 'config.form_feed.token_revoke'|trans }}</a>
|
||||
{% else %}
|
||||
{{ 'config.form_feed.token_create'|trans }}
|
||||
{% endif %}</a>
|
||||
– <a href="{{ path('generate_token') }}">{{ 'config.form_feed.token_create'|trans }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue