diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-12-03 06:51:06 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-23 13:28:03 +0100 |
commit | dfd0a7bc5feb4fd7b77d7e2f3a25c5c3febc1eba (patch) | |
tree | 112b4403052b0420804dc8a7bcba199f534d902e /src | |
parent | 6e4fc956abc909232044e7af0fa37cbb1b510f18 (diff) | |
download | wallabag-dfd0a7bc5feb4fd7b77d7e2f3a25c5c3febc1eba.tar.gz wallabag-dfd0a7bc5feb4fd7b77d7e2f3a25c5c3febc1eba.tar.zst wallabag-dfd0a7bc5feb4fd7b77d7e2f3a25c5c3febc1eba.zip |
Add backup codes
Diffstat (limited to 'src')
18 files changed, 71 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 846e96ff..c9fc5702 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use PragmaRX\Recovery\Recovery as BackupCodes; | ||
5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
6 | use Symfony\Component\HttpFoundation\JsonResponse; | 7 | use Symfony\Component\HttpFoundation\JsonResponse; |
7 | use Symfony\Component\HttpFoundation\RedirectResponse; | 8 | use Symfony\Component\HttpFoundation\RedirectResponse; |
@@ -93,10 +94,12 @@ class ConfigController extends Controller | |||
93 | 94 | ||
94 | $user->setGoogleAuthenticatorSecret($secret); | 95 | $user->setGoogleAuthenticatorSecret($secret); |
95 | $user->setEmailTwoFactor(false); | 96 | $user->setEmailTwoFactor(false); |
97 | $user->setBackupCodes((new BackupCodes())->toArray()); | ||
96 | 98 | ||
97 | $this->addFlash('OtpQrCode', $this->get('scheb_two_factor.security.google_authenticator')->getQRContent($user)); | 99 | $this->addFlash('OtpQrCode', $this->get('scheb_two_factor.security.google_authenticator')->getQRContent($user)); |
98 | } elseif (false === $userForm->get('googleTwoFactor')->getData() && true === $user->isGoogleAuthenticatorEnabled()) { | 100 | } elseif (false === $userForm->get('googleTwoFactor')->getData() && true === $user->isGoogleAuthenticatorEnabled()) { |
99 | $user->setGoogleAuthenticatorSecret(null); | 101 | $user->setGoogleAuthenticatorSecret(null); |
102 | $user->setBackupCodes(null); | ||
100 | } | 103 | } |
101 | } | 104 | } |
102 | 105 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index d3e96e5c..0114a983 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | # title: Delete my account (a.k.a danger zone) | 112 | # title: Delete my account (a.k.a danger zone) |
112 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. | 113 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 9aeddceb..fd9796ba 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | title: 'Lösche mein Konto (a.k.a Gefahrenzone)' | 112 | title: 'Lösche mein Konto (a.k.a Gefahrenzone)' |
112 | description: 'Wenn du dein Konto löschst, werden ALL deine Artikel, ALL deine Tags, ALL deine Anmerkungen und dein Konto dauerhaft gelöscht (kann NICHT RÜCKGÄNGIG gemacht werden). Du wirst anschließend ausgeloggt.' | 113 | description: 'Wenn du dein Konto löschst, werden ALL deine Artikel, ALL deine Tags, ALL deine Anmerkungen und dein Konto dauerhaft gelöscht (kann NICHT RÜCKGÄNGIG gemacht werden). Du wirst anschließend ausgeloggt.' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 22c68c79..ddc079ed 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | two_factor_code_description_3: 'Or use that code:' | 109 | two_factor_code_description_3: 'Or use that code:' |
110 | two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | title: Delete my account (a.k.a danger zone) | 112 | title: Delete my account (a.k.a danger zone) |
112 | description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. | 113 | description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 6e710e56..8ac66169 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | title: Eliminar mi cuenta (Zona peligrosa) | 112 | title: Eliminar mi cuenta (Zona peligrosa) |
112 | description: Si eliminas tu cuenta, TODOS tus artículos, TODAS tus etiquetas, TODAS tus anotaciones y tu cuenta serán eliminadas de forma PERMANENTE (no se puede deshacer). Después serás desconectado. | 113 | description: Si eliminas tu cuenta, TODOS tus artículos, TODAS tus etiquetas, TODAS tus anotaciones y tu cuenta serán eliminadas de forma PERMANENTE (no se puede deshacer). Después serás desconectado. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 855f38cc..bc754ca2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | # title: Delete my account (a.k.a danger zone) | 112 | # title: Delete my account (a.k.a danger zone) |
112 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. | 113 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index f92b64a5..28841145 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | two_factor_code_description_1: Vous venez d’activer l’authentification double-facteur, ouvrez votre application OTP pour configurer la génération du mot de passe à usage unique. Ces informations disparaîtront après un rechargement de la page. | 107 | two_factor_code_description_1: Vous venez d’activer l’authentification double-facteur, ouvrez votre application OTP pour configurer la génération du mot de passe à usage unique. Ces informations disparaîtront après un rechargement de la page. |
108 | two_factor_code_description_2: 'Vous pouvez scanner le QR code avec votre application :' | 108 | two_factor_code_description_2: 'Vous pouvez scanner le QR code avec votre application :' |
109 | two_factor_code_description_3: 'Ou utiliser le code suivant :' | 109 | two_factor_code_description_3: 'Ou utiliser le code suivant :' |
110 | two_factor_code_description_4: 'N’oubliez pas de sauvegarder ces codes de secours dans un endroit sûr, vous pourrez les utiliser si vous ne pouvez plus accéder à votre application OTP :' | ||
110 | delete: | 111 | delete: |
111 | title: "Supprimer mon compte (attention danger !)" | 112 | title: "Supprimer mon compte (attention danger !)" |
112 | description: "Si vous confirmez la suppression de votre compte, TOUS les articles, TOUS les tags, TOUTES les annotations et votre compte seront DÉFINITIVEMENT supprimé (c’est IRRÉVERSIBLE). Vous serez ensuite déconnecté." | 113 | description: "Si vous confirmez la suppression de votre compte, TOUS les articles, TOUS les tags, TOUTES les annotations et votre compte seront DÉFINITIVEMENT supprimé (c’est IRRÉVERSIBLE). Vous serez ensuite déconnecté." |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 95d4ac20..b78dcb32 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | title: Cancella il mio account (zona pericolosa) | 112 | title: Cancella il mio account (zona pericolosa) |
112 | description: Rimuovendo il tuo account, TUTTI i tuoi articoli, TUTTE le tue etichette, TUTTE le tue annotazioni ed il tuo account verranno rimossi PERMANENTEMENTE (impossibile da ANNULLARE). Verrai poi disconnesso. | 113 | description: Rimuovendo il tuo account, TUTTI i tuoi articoli, TUTTE le tue etichette, TUTTE le tue annotazioni ed il tuo account verranno rimossi PERMANENTEMENTE (impossibile da ANNULLARE). Verrai poi disconnesso. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 96725a06..c1f57bc7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | title: Suprimir mon compte (Mèfi zòna perilhosa) | 112 | title: Suprimir mon compte (Mèfi zòna perilhosa) |
112 | description: Se confirmatz la supression de vòstre compte, TOTES vòstres articles, TOTAS vòstras etiquetas, TOTAS vòstras anotacions e vòstre compte seràn suprimits per totjorn. E aquò es IRREVERSIBLE. Puèi seretz desconnectat. | 113 | description: Se confirmatz la supression de vòstre compte, TOTES vòstres articles, TOTAS vòstras etiquetas, TOTAS vòstras anotacions e vòstre compte seràn suprimits per totjorn. E aquò es IRREVERSIBLE. Puèi seretz desconnectat. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 5f77061c..2dc8d854 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | title: Usuń moje konto (niebezpieczna strefa !) | 112 | title: Usuń moje konto (niebezpieczna strefa !) |
112 | description: Jeżeli usuniesz swoje konto, wszystkie twoje artykuły, tagi, adnotacje, oraz konto zostaną trwale usunięte (operacja jest NIEODWRACALNA). Następnie zostaniesz wylogowany. | 113 | description: Jeżeli usuniesz swoje konto, wszystkie twoje artykuły, tagi, adnotacje, oraz konto zostaną trwale usunięte (operacja jest NIEODWRACALNA). Następnie zostaniesz wylogowany. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index f40f9795..a81d8d0d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | # title: Delete my account (a.k.a danger zone) | 112 | # title: Delete my account (a.k.a danger zone) |
112 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. | 113 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 369d2d44..fd565819 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | # title: Delete my account (a.k.a danger zone) | 112 | # title: Delete my account (a.k.a danger zone) |
112 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. | 113 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml index d9b33fed..5a0c5445 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml | |||
@@ -104,6 +104,7 @@ config: | |||
104 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 104 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
105 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 105 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
106 | # two_factor_code_description_3: 'Or use that code:' | 106 | # two_factor_code_description_3: 'Or use that code:' |
107 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
107 | delete: | 108 | delete: |
108 | title: "Удалить мой аккаунт (или опасная зона)" | 109 | title: "Удалить мой аккаунт (или опасная зона)" |
109 | description: "Если Вы удалите ваш аккаунт, ВСЕ ваши записи, теги и другие данные, будут БЕЗВОЗВРАТНО удалены (операция не может быть отменена после). Затем Вы выйдете из системы." | 110 | description: "Если Вы удалите ваш аккаунт, ВСЕ ваши записи, теги и другие данные, будут БЕЗВОЗВРАТНО удалены (операция не может быть отменена после). Затем Вы выйдете из системы." |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml index f25bac84..a69b5008 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | title: ลบบัญชีของฉัน (โซนที่เป็นภัย!) | 112 | title: ลบบัญชีของฉัน (โซนที่เป็นภัย!) |
112 | description: ถ้าคุณลบบัญชีของคุณIf , รายการทั้งหมดของคุณ, แท็กทั้งหมดของคุณ, หมายเหตุทั้งหมดของคุณและบัญชีของคุณจะถูกลบอย่างถาวร (มันไม่สามารถยกเลิกได้) คุณจะต้องลงชื่อออก | 113 | description: ถ้าคุณลบบัญชีของคุณIf , รายการทั้งหมดของคุณ, แท็กทั้งหมดของคุณ, หมายเหตุทั้งหมดของคุณและบัญชีของคุณจะถูกลบอย่างถาวร (มันไม่สามารถยกเลิกได้) คุณจะต้องลงชื่อออก |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index d65fc001..0c3d84e9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -107,6 +107,7 @@ config: | |||
107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. | 107 | # two_factor_code_description_1: You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. It'll disapear after a page reload. |
108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' | 108 | # two_factor_code_description_2: 'You can scan that QR Code with your app:' |
109 | # two_factor_code_description_3: 'Or use that code:' | 109 | # two_factor_code_description_3: 'Or use that code:' |
110 | # two_factor_code_description_4: 'Also, save these backup codes in a safe place, you can use them in case you lose access to your OTP app:' | ||
110 | delete: | 111 | delete: |
111 | # title: Delete my account (a.k.a danger zone) | 112 | # title: Delete my account (a.k.a danger zone) |
112 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. | 113 | # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. |
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 6ee57443..cf439408 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 | |||
@@ -187,19 +187,22 @@ | |||
187 | </div> | 187 | </div> |
188 | {% for OtpQrCode in app.session.flashbag.get('OtpQrCode') %} | 188 | {% for OtpQrCode in app.session.flashbag.get('OtpQrCode') %} |
189 | <div class="row"> | 189 | <div class="row"> |
190 | You just enabled the OTP two factor authentication, open your OTP app and use that code to get a one time password. | 190 | {{ 'config.form_user.two_factor_code_description_1'|trans }} |
191 | <br/> | 191 | <br/> |
192 | That code will disapear after a page reload. | 192 | {{ 'config.form_user.two_factor_code_description_2'|trans }} |
193 | <br/><br/> | 193 | <br/><br/> |
194 | <strong>{{ app.user.getGoogleAuthenticatorSecret }}</strong> | ||
195 | <br/><br/> | ||
196 | Or you can scan that QR Code with your app: | ||
197 | <br/> | ||
198 | <img id="2faQrcode" class="hide-on-med-and-down" /> | 194 | <img id="2faQrcode" class="hide-on-med-and-down" /> |
199 | |||
200 | <script> | 195 | <script> |
201 | document.getElementById('2faQrcode').src = jrQrcode.getQrBase64('{{ OtpQrCode }}');; | 196 | document.getElementById('2faQrcode').src = jrQrcode.getQrBase64('{{ OtpQrCode }}'); |
202 | </script> | 197 | </script> |
198 | <br/><br/> | ||
199 | {{ 'config.form_user.two_factor_code_description_3'|trans }} | ||
200 | <br/><br/> | ||
201 | <strong>{{ app.user.getGoogleAuthenticatorSecret }}</strong> | ||
202 | <br/><br/> | ||
203 | {{ 'config.form_user.two_factor_code_description_4'|trans }} | ||
204 | <br/><br/> | ||
205 | <strong>{{ app.user.getBackupCodes|join("\n")|nl2br }}</strong> | ||
203 | </div> | 206 | </div> |
204 | {% endfor %} | 207 | {% endfor %} |
205 | </fieldset> | 208 | </fieldset> |
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 73cf592e..5b00eb7b 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 | |||
@@ -112,7 +112,7 @@ | |||
112 | <img id="androidQrcode" class="hide-on-med-and-down" /> | 112 | <img id="androidQrcode" class="hide-on-med-and-down" /> |
113 | </div> | 113 | </div> |
114 | <script> | 114 | <script> |
115 | document.getElementById('androidQrcode').src = jrQrcode.getQrBase64('wallabag://{{ app.user.username }}@{{ wallabag_url }}');; | 115 | document.getElementById('androidQrcode').src = jrQrcode.getQrBase64('wallabag://{{ app.user.username }}@{{ wallabag_url }}'); |
116 | </script> | 116 | </script> |
117 | </div> | 117 | </div> |
118 | 118 | ||
@@ -220,12 +220,16 @@ | |||
220 | <br/><br/> | 220 | <br/><br/> |
221 | <img id="2faQrcode" class="hide-on-med-and-down" /> | 221 | <img id="2faQrcode" class="hide-on-med-and-down" /> |
222 | <script> | 222 | <script> |
223 | document.getElementById('2faQrcode').src = jrQrcode.getQrBase64('{{ OtpQrCode }}');; | 223 | document.getElementById('2faQrcode').src = jrQrcode.getQrBase64('{{ OtpQrCode }}'); |
224 | </script> | 224 | </script> |
225 | <br/><br/> | 225 | <br/><br/> |
226 | {{ 'config.form_user.two_factor_code_description_3'|trans }} | 226 | {{ 'config.form_user.two_factor_code_description_3'|trans }} |
227 | <br/><br/> | 227 | <br/><br/> |
228 | <strong>{{ app.user.getGoogleAuthenticatorSecret }}</strong> | 228 | <strong>{{ app.user.getGoogleAuthenticatorSecret }}</strong> |
229 | <br/><br/> | ||
230 | {{ 'config.form_user.two_factor_code_description_4'|trans }} | ||
231 | <br/><br/> | ||
232 | <strong>{{ app.user.getBackupCodes|join("\n")|nl2br }}</strong> | ||
229 | </div> | 233 | </div> |
230 | {% endfor %} | 234 | {% endfor %} |
231 | {% endif %} | 235 | {% endif %} |
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index 6e305719..ab34e2bf 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php | |||
@@ -8,6 +8,7 @@ use FOS\UserBundle\Model\User as BaseUser; | |||
8 | use JMS\Serializer\Annotation\Accessor; | 8 | use JMS\Serializer\Annotation\Accessor; |
9 | use JMS\Serializer\Annotation\Groups; | 9 | use JMS\Serializer\Annotation\Groups; |
10 | use JMS\Serializer\Annotation\XmlRoot; | 10 | use JMS\Serializer\Annotation\XmlRoot; |
11 | use Scheb\TwoFactorBundle\Model\BackupCodeInterface; | ||
11 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface as EmailTwoFactorInterface; | 12 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface as EmailTwoFactorInterface; |
12 | use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface as GoogleTwoFactorInterface; | 13 | use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface as GoogleTwoFactorInterface; |
13 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | 14 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
@@ -28,7 +29,7 @@ use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; | |||
28 | * @UniqueEntity("email") | 29 | * @UniqueEntity("email") |
29 | * @UniqueEntity("username") | 30 | * @UniqueEntity("username") |
30 | */ | 31 | */ |
31 | class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorInterface | 32 | class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorInterface, BackupCodeInterface |
32 | { | 33 | { |
33 | use EntityTimestampsTrait; | 34 | use EntityTimestampsTrait; |
34 | 35 | ||
@@ -128,6 +129,11 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI | |||
128 | private $googleAuthenticatorSecret; | 129 | private $googleAuthenticatorSecret; |
129 | 130 | ||
130 | /** | 131 | /** |
132 | * @ORM\Column(type="json_array", nullable=true) | ||
133 | */ | ||
134 | private $backupCodes; | ||
135 | |||
136 | /** | ||
131 | * @var bool | 137 | * @var bool |
132 | * | 138 | * |
133 | * @ORM\Column(type="boolean") | 139 | * @ORM\Column(type="boolean") |
@@ -318,6 +324,36 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI | |||
318 | $this->googleAuthenticatorSecret = $googleAuthenticatorSecret; | 324 | $this->googleAuthenticatorSecret = $googleAuthenticatorSecret; |
319 | } | 325 | } |
320 | 326 | ||
327 | public function setBackupCodes(array $codes = null) | ||
328 | { | ||
329 | $this->backupCodes = $codes; | ||
330 | } | ||
331 | |||
332 | public function getBackupCodes() | ||
333 | { | ||
334 | return $this->backupCodes; | ||
335 | } | ||
336 | |||
337 | /** | ||
338 | * {@inheritdoc} | ||
339 | */ | ||
340 | public function isBackupCode(string $code): bool | ||
341 | { | ||
342 | return \in_array($code, $this->backupCodes, true); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * {@inheritdoc} | ||
347 | */ | ||
348 | public function invalidateBackupCode(string $code): void | ||
349 | { | ||
350 | $key = array_search($code, $this->backupCodes, true); | ||
351 | |||
352 | if (false !== $key) { | ||
353 | unset($this->backupCodes[$key]); | ||
354 | } | ||
355 | } | ||
356 | |||
321 | /** | 357 | /** |
322 | * @param Client $client | 358 | * @param Client $client |
323 | * | 359 | * |