aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/en/user/configuration.rst2
-rw-r--r--docs/fr/user/configuration.rst2
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php4
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php37
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml83
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml5
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig9
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig12
-rw-r--r--src/Wallabag/UserBundle/Repository/UserRepository.php14
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php120
19 files changed, 292 insertions, 41 deletions
diff --git a/docs/en/user/configuration.rst b/docs/en/user/configuration.rst
index f4c55dea..824878dc 100644
--- a/docs/en/user/configuration.rst
+++ b/docs/en/user/configuration.rst
@@ -50,6 +50,8 @@ User information
50 50
51You can change your name, your email address and enable ``Two factor authentication``. 51You can change your name, your email address and enable ``Two factor authentication``.
52 52
53If the wallabag instance has more than one enabled user, you can delete your account here. **Take care, we delete all your data**.
54
53Two factor authentication 55Two factor authentication
54~~~~~~~~~~~~~~~~~~~~~~~~~ 56~~~~~~~~~~~~~~~~~~~~~~~~~
55 57
diff --git a/docs/fr/user/configuration.rst b/docs/fr/user/configuration.rst
index 278f0022..2654e8ad 100644
--- a/docs/fr/user/configuration.rst
+++ b/docs/fr/user/configuration.rst
@@ -51,6 +51,8 @@ Mon compte
51 51
52Vous pouvez ici modifier votre nom, votre adresse email et activer la ``Double authentification``. 52Vous pouvez ici modifier votre nom, votre adresse email et activer la ``Double authentification``.
53 53
54Si l'instance de wallabag compte plus d'un utilisateur actif, vous pouvez supprimer ici votre compte. **Attention, nous supprimons toutes vos données**.
55
54Double authentification (2FA) 56Double authentification (2FA)
55~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56 58
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 8e438229..59110782 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -77,7 +77,7 @@ class InstallCommand extends ContainerAwareCommand
77 77
78 // testing if database driver exists 78 // testing if database driver exists
79 $fulfilled = true; 79 $fulfilled = true;
80 $label = '<comment>PDO Driver</comment>'; 80 $label = '<comment>PDO Driver (%s)</comment>';
81 $status = '<info>OK!</info>'; 81 $status = '<info>OK!</info>';
82 $help = ''; 82 $help = '';
83 83
@@ -87,7 +87,7 @@ class InstallCommand extends ContainerAwareCommand
87 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.'; 87 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.';
88 } 88 }
89 89
90 $rows[] = [$label, $status, $help]; 90 $rows[] = [sprintf($label, $this->getContainer()->getParameter('database_driver')), $status, $help];
91 91
92 // testing if connection to the database can be etablished 92 // testing if connection to the database can be etablished
93 $label = '<comment>Database connection</comment>'; 93 $label = '<comment>Database connection</comment>';
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 91cdcae5..abd35c02 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\JsonResponse; 7use Symfony\Component\HttpFoundation\JsonResponse;
8use Symfony\Component\HttpFoundation\RedirectResponse; 8use Symfony\Component\HttpFoundation\RedirectResponse;
9use Symfony\Component\HttpFoundation\Request; 9use Symfony\Component\HttpFoundation\Request;
10use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
10use Wallabag\CoreBundle\Entity\Config; 11use Wallabag\CoreBundle\Entity\Config;
11use Wallabag\CoreBundle\Entity\TaggingRule; 12use Wallabag\CoreBundle\Entity\TaggingRule;
12use Wallabag\CoreBundle\Form\Type\ConfigType; 13use Wallabag\CoreBundle\Form\Type\ConfigType;
@@ -148,6 +149,9 @@ class ConfigController extends Controller
148 'token' => $config->getRssToken(), 149 'token' => $config->getRssToken(),
149 ], 150 ],
150 'twofactor_auth' => $this->getParameter('twofactor_auth'), 151 'twofactor_auth' => $this->getParameter('twofactor_auth'),
152 'enabled_users' => $this->getDoctrine()
153 ->getRepository('WallabagUserBundle:User')
154 ->getSumEnabledUsers(),
151 ]); 155 ]);
152 } 156 }
153 157
@@ -251,4 +255,37 @@ class ConfigController extends Controller
251 255
252 return $config; 256 return $config;
253 } 257 }
258
259 /**
260 * Delete account for current user.
261 *
262 * @Route("/account/delete", name="delete_account")
263 *
264 * @param Request $request
265 *
266 * @throws AccessDeniedHttpException
267 *
268 * @return \Symfony\Component\HttpFoundation\RedirectResponse
269 */
270 public function deleteAccountAction(Request $request)
271 {
272 $enabledUsers = $this->getDoctrine()
273 ->getRepository('WallabagUserBundle:User')
274 ->getSumEnabledUsers();
275
276 if ($enabledUsers <= 1) {
277 throw new AccessDeniedHttpException();
278 }
279
280 $user = $this->getUser();
281
282 // logout current user
283 $this->get('security.token_storage')->setToken(null);
284 $request->getSession()->invalidate();
285
286 $em = $this->get('fos_user.user_manager');
287 $em->deleteUser($user);
288
289 return $this->redirect($this->generateUrl('fos_user_security_login'));
290 }
254} 291}
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index bb23b5fe..f5548a21 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Navn' 88 name_label: 'Navn'
89 email_label: 'Emailadresse' 89 email_label: 'Emailadresse'
90 # twoFactorAuthentication_label: 'Two factor authentication' 90 # twoFactorAuthentication_label: 'Two factor authentication'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Gammel adgangskode' 97 old_password_label: 'Gammel adgangskode'
93 new_password_label: 'Ny adgangskode' 98 new_password_label: 'Ny adgangskode'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 079cfece..9edd7fb7 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Name' 88 name_label: 'Name'
89 email_label: 'E-Mail-Adresse' 89 email_label: 'E-Mail-Adresse'
90 twoFactorAuthentication_label: 'Zwei-Faktor-Authentifizierung' 90 twoFactorAuthentication_label: 'Zwei-Faktor-Authentifizierung'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Altes Kennwort' 97 old_password_label: 'Altes Kennwort'
93 new_password_label: 'Neues Kennwort' 98 new_password_label: 'Neues Kennwort'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 34a6f74e..b86145a0 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Name' 88 name_label: 'Name'
89 email_label: 'Email' 89 email_label: 'Email'
90 twoFactorAuthentication_label: 'Two factor authentication' 90 twoFactorAuthentication_label: 'Two factor authentication'
91 delete:
92 title: Delete my account (danger zone !)
93 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.
94 confirm: Are you really sure? (it can't be UNDONE)
95 button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Current password' 97 old_password_label: 'Current password'
93 new_password_label: 'New password' 98 new_password_label: 'New password'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 29f0676e..b7187f50 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Nombre' 88 name_label: 'Nombre'
89 email_label: 'Direccion e-mail' 89 email_label: 'Direccion e-mail'
90 twoFactorAuthentication_label: 'AutentificaciĂ³n de dos factores' 90 twoFactorAuthentication_label: 'AutentificaciĂ³n de dos factores'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Contraseña actual' 97 old_password_label: 'Contraseña actual'
93 new_password_label: 'Nueva contraseña' 98 new_password_label: 'Nueva contraseña'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 074ab7a8..0751752b 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'نام' 88 name_label: 'نام'
89 email_label: 'نشانی ایمیل' 89 email_label: 'نشانی ایمیل'
90 twoFactorAuthentication_label: 'تأیید ۲مرحله‌ای' 90 twoFactorAuthentication_label: 'تأیید ۲مرحله‌ای'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'رمز قدیمی' 97 old_password_label: 'رمز قدیمی'
93 new_password_label: 'رمز تازه' 98 new_password_label: 'رمز تازه'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 55453b6c..8d19ccb1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Nom' 88 name_label: 'Nom'
89 email_label: 'Adresse e-mail' 89 email_label: 'Adresse e-mail'
90 twoFactorAuthentication_label: 'Double authentification' 90 twoFactorAuthentication_label: 'Double authentification'
91 delete:
92 title: Supprimer mon compte (attention danger !)
93 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é.
94 confirm: Vous Ăªtes vraiment sĂ»r ? (c'est IRRÉVERSIBLE !)
95 button: 'Supprimer mon compte'
91 form_password: 96 form_password:
92 old_password_label: 'Mot de passe actuel' 97 old_password_label: 'Mot de passe actuel'
93 new_password_label: 'Nouveau mot de passe' 98 new_password_label: 'Nouveau mot de passe'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 67205c6d..4d3452ea 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Nome' 88 name_label: 'Nome'
89 email_label: 'E-mail' 89 email_label: 'E-mail'
90 twoFactorAuthentication_label: 'Two factor authentication' 90 twoFactorAuthentication_label: 'Two factor authentication'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Password corrente' 97 old_password_label: 'Password corrente'
93 new_password_label: 'Nuova password' 98 new_password_label: 'Nuova password'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 25e5f05a..f14213c6 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -25,13 +25,13 @@ menu:
25 internal_settings: 'Configuracion interna' 25 internal_settings: 'Configuracion interna'
26 import: 'Importar' 26 import: 'Importar'
27 howto: 'Ajuda' 27 howto: 'Ajuda'
28 developer: 'Desvolopador' 28 developer: 'Desvolopaire'
29 logout: 'Desconnexion' 29 logout: 'Desconnexion'
30 about: 'A prepaus' 30 about: 'A prepaus'
31 search: 'Cercar' 31 search: 'Cercar'
32 save_link: 'Enregistrar un novèl article' 32 save_link: 'Enregistrar un novèl article'
33 back_to_unread: 'Tornar als articles pas legits' 33 back_to_unread: 'Tornar als articles pas legits'
34 # users_management: 'Users management' 34 users_management: 'Gestion dels utilizaires'
35 top: 35 top:
36 add_new_entry: 'Enregistrar un novèl article' 36 add_new_entry: 'Enregistrar un novèl article'
37 search: 'Cercar' 37 search: 'Cercar'
@@ -46,7 +46,7 @@ footer:
46 social: 'Social' 46 social: 'Social'
47 powered_by: 'propulsat per' 47 powered_by: 'propulsat per'
48 about: 'A prepaus' 48 about: 'A prepaus'
49 # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! 49 stats: "Dempuèi %user_creation% avètz legit %nb_archives% articles. Es a l'entorn de %per_day% per jorn !"
50 50
51config: 51config:
52 page_title: 'Configuracion' 52 page_title: 'Configuracion'
@@ -88,6 +88,11 @@ config:
88 name_label: 'Nom' 88 name_label: 'Nom'
89 email_label: 'Adreça de corrièl' 89 email_label: 'Adreça de corrièl'
90 twoFactorAuthentication_label: 'Dobla autentificacion' 90 twoFactorAuthentication_label: 'Dobla autentificacion'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Senhal actual' 97 old_password_label: 'Senhal actual'
93 new_password_label: 'Senhal novèl' 98 new_password_label: 'Senhal novèl'
@@ -96,7 +101,7 @@ config:
96 if_label: 'se' 101 if_label: 'se'
97 then_tag_as_label: 'alara atribuir las etiquetas' 102 then_tag_as_label: 'alara atribuir las etiquetas'
98 delete_rule_label: 'suprimir' 103 delete_rule_label: 'suprimir'
99 # edit_rule_label: 'edit' 104 edit_rule_label: 'modificar'
100 rule_label: 'Règla' 105 rule_label: 'Règla'
101 tags_label: 'Etiquetas' 106 tags_label: 'Etiquetas'
102 faq: 107 faq:
@@ -209,7 +214,7 @@ entry:
209 is_public_label: 'Public' 214 is_public_label: 'Public'
210 save_label: 'Enregistrar' 215 save_label: 'Enregistrar'
211 public: 216 public:
212 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" 217 shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>"
213 218
214about: 219about:
215 page_title: 'A prepaus' 220 page_title: 'A prepaus'
@@ -265,14 +270,14 @@ howto:
265 270
266quickstart: 271quickstart:
267 page_title: 'Per ben començar' 272 page_title: 'Per ben començar'
268 # more: 'More…' 273 more: 'Mai…'
269 intro: 274 intro:
270 title: 'Benvenguda sus wallabag !' 275 title: 'Benvenguda sus wallabag !'
271 paragraph_1: "Anem vos guidar per far lo torn de la proprietat e vos presentar unas fonccionalitats que vos poiriĂ¡n interessar per vos apropriar aquesta aisina." 276 paragraph_1: "Anem vos guidar per far lo torn de la proprietat e vos presentar unas fonccionalitats que vos poiriĂ¡n interessar per vos apropriar aquesta aisina."
272 paragraph_2: 'Seguètz-nos ' 277 paragraph_2: 'Seguètz-nos '
273 configure: 278 configure:
274 title: "Configuratz l'aplicacio" 279 title: "Configuratz l'aplicacion"
275 # description: 'In order to have an application which suits you, have a look into the configuration of wallabag.' 280 description: "Per fin d'aver una aplicacion que vos va ben, anatz veire la configuracion de wallabag."
276 language: "Cambiatz la lenga e l'estil de l'aplicacion" 281 language: "Cambiatz la lenga e l'estil de l'aplicacion"
277 rss: 'Activatz los fluxes RSS' 282 rss: 'Activatz los fluxes RSS'
278 tagging_rules: 'Escrivètz de règlas per classar automaticament vĂ²stres articles' 283 tagging_rules: 'Escrivètz de règlas per classar automaticament vĂ²stres articles'
@@ -286,7 +291,7 @@ quickstart:
286 import: 'Configurar los impĂ²rt' 291 import: 'Configurar los impĂ²rt'
287 first_steps: 292 first_steps:
288 title: 'Primièrs passes' 293 title: 'Primièrs passes'
289 # description: "Now wallabag is well configured, it's time to archive the web. You can click on the top right sign + to add a link." 294 description: "Ara wallabag es ben configurat, es lo moment d'archivar lo web. Podètz clicar sul signe + a man drecha amont per ajustar un ligam."
290 new_article: 'Ajustatz vĂ²stre primièr article' 295 new_article: 'Ajustatz vĂ²stre primièr article'
291 unread_articles: 'E racaptatz-lo !' 296 unread_articles: 'E racaptatz-lo !'
292 migrate: 297 migrate:
@@ -298,14 +303,14 @@ quickstart:
298 readability: 'Migrar dempuèi Readability' 303 readability: 'Migrar dempuèi Readability'
299 instapaper: 'Migrar dempuèi Instapaper' 304 instapaper: 'Migrar dempuèi Instapaper'
300 developer: 305 developer:
301 title: 'Pels desvolopadors' 306 title: 'Pels desvolopaires'
302 # description: 'We also thought to the developers: Docker, API, translations, etc.' 307 description: 'Avèm tanben pensat als desvolopaires : Docker, API, traduccions, etc.'
303 create_application: 'Crear vĂ²stra aplicacion tèrça' 308 create_application: 'Crear vĂ²stra aplicacion tèrça'
304 # use_docker: 'Use Docker to install wallabag' 309 use_docker: 'Utilizar Docker per installar wallabag'
305 docs: 310 docs:
306 title: 'Documentacion complèta' 311 title: 'Documentacion complèta'
307 # description: "There are so much features in wallabag. Don't hesitate to read the manual to know them and to learn how to use them." 312 description: "I a un fum de fonccionalitats dins wallabag. Esitetz pas a legir lo manual per las conéisser e aprendre a las utilizar."
308 annotate: 'Anotatar vĂ²stre article' 313 annotate: 'Anotar vĂ²stre article'
309 export: 'Convertissètz vĂ²stres articles en ePub o en PDF' 314 export: 'Convertissètz vĂ²stres articles en ePub o en PDF'
310 search_filters: "Aprenètz a utilizar lo motor de recèrca e los filtres per retrobar l'article que vos interèssa" 315 search_filters: "Aprenètz a utilizar lo motor de recèrca e los filtres per retrobar l'article que vos interèssa"
311 fetching_errors: "Qué far se mon article es pas recuperat coma cal ?" 316 fetching_errors: "Qué far se mon article es pas recuperat coma cal ?"
@@ -390,7 +395,7 @@ developer:
390 warn_message_2: "Se suprimissètz un client, totas las aplicacions que l'emplegan foncionarĂ n pas mai amb vĂ²stre compte wallabag." 395 warn_message_2: "Se suprimissètz un client, totas las aplicacions que l'emplegan foncionarĂ n pas mai amb vĂ²stre compte wallabag."
391 action: 'Suprimir aqueste client' 396 action: 'Suprimir aqueste client'
392 client: 397 client:
393 page_title: 'Desvlopador > Novèl client' 398 page_title: 'Desvolopaire > Novèl client'
394 page_description: "Anatz crear un novèl client. MercĂ©s de cumplir l'url de redireccion cap a vĂ²stra aplicacion." 399 page_description: "Anatz crear un novèl client. MercĂ©s de cumplir l'url de redireccion cap a vĂ²stra aplicacion."
395 form: 400 form:
396 name_label: "Nom del client" 401 name_label: "Nom del client"
@@ -398,7 +403,7 @@ developer:
398 save_label: 'Crear un novèl client' 403 save_label: 'Crear un novèl client'
399 action_back: 'Retorn' 404 action_back: 'Retorn'
400 client_parameter: 405 client_parameter:
401 page_title: 'Desvolopador > Los paramètres de vĂ²stre client' 406 page_title: 'Desvolopaire > Los paramètres de vĂ²stre client'
402 page_description: 'VaquĂ­ los paramètres de vĂ²stre client' 407 page_description: 'VaquĂ­ los paramètres de vĂ²stre client'
403 field_name: 'Nom del client' 408 field_name: 'Nom del client'
404 field_id: 'ID Client' 409 field_id: 'ID Client'
@@ -406,7 +411,7 @@ developer:
406 back: 'Retour' 411 back: 'Retour'
407 read_howto: 'Legir "cossí crear ma primièra aplicacion"' 412 read_howto: 'Legir "cossí crear ma primièra aplicacion"'
408 howto: 413 howto:
409 page_title: 'Desvolopador > Cossí crear ma primièra aplicacion' 414 page_title: 'Desvolopaire > Cossí crear ma primièra aplicacion'
410 description: 415 description:
411 paragraph_1: "Las comandas seguentas utilizan la <a href=\"https://github.com/jkbrzt/httpie\">bibliotèca HTTPie</a>. Asseguratz-vos que siasqueĂ²u installadas abans de l'utilizar." 416 paragraph_1: "Las comandas seguentas utilizan la <a href=\"https://github.com/jkbrzt/httpie\">bibliotèca HTTPie</a>. Asseguratz-vos que siasqueĂ²u installadas abans de l'utilizar."
412 paragraph_2: "Vos cal un geton per escambiar entre vĂ²stra aplicacion e l'API de wallabar." 417 paragraph_2: "Vos cal un geton per escambiar entre vĂ²stra aplicacion e l'API de wallabar."
@@ -419,31 +424,31 @@ developer:
419 back: 'Retorn' 424 back: 'Retorn'
420 425
421user: 426user:
422 # page_title: Users management 427 page_title: 'Gestion dels utilizaires'
423 # new_user: Create a new user 428 new_user: 'Crear un novèl utilizaire'
424 # edit_user: Edit an existing user 429 edit_user: 'Modificar un utilizaire existent'
425 # description: "Here you can manage all users (create, edit and delete)" 430 description: "Aquí podètz gerir totes los utilizaires (crear, modificar e suprimir)"
426 # list: 431 list:
427 # actions: Actions 432 actions: 'Accions'
428 # edit_action: Edit 433 edit_action: 'Modificar'
429 # yes: Yes 434 yes: 'Ă’c'
430 # no: No 435 no: 'Non'
431 # create_new_one: Create a new user 436 create_new_one: 'Crear un novèl utilizaire'
432 form: 437 form:
433 username_label: "Nom d'utilizaire" 438 username_label: "Nom d'utilizaire"
434 # name_label: 'Name' 439 name_label: 'Nom'
435 password_label: 'Senhal' 440 password_label: 'Senhal'
436 repeat_new_password_label: 'Confirmatz vĂ²stre novèl senhal' 441 repeat_new_password_label: 'Confirmatz vĂ²stre novèl senhal'
437 plain_password_label: 'Senhal en clar' 442 plain_password_label: 'Senhal en clar'
438 email_label: 'Adreça de corrièl' 443 email_label: 'Adreça de corrièl'
439 # enabled_label: 'Enabled' 444 enabled_label: 'Actiu'
440 # locked_label: 'Locked' 445 locked_label: 'Varrolhat'
441 # last_login_label: 'Last login' 446 last_login_label: 'Darrièra connexion'
442 # twofactor_label: Two factor authentication 447 twofactor_label: 'Autentificacion doble-factor'
443 # save: Save 448 save: 'Enregistrar'
444 # delete: Delete 449 delete: 'Suprimir'
445 # delete_confirm: Are you sure? 450 delete_confirm: 'Sètz segur ?'
446 # back_to_list: Back to list 451 back_to_list: 'Tornar a la lista'
447 452
448flashes: 453flashes:
449 config: 454 config:
@@ -455,7 +460,7 @@ flashes:
455 rss_updated: 'La configuracion dels fluxes RSS es ben estada mesa a jorn' 460 rss_updated: 'La configuracion dels fluxes RSS es ben estada mesa a jorn'
456 tagging_rules_updated: 'Règlas misa a jorn' 461 tagging_rules_updated: 'Règlas misa a jorn'
457 tagging_rules_deleted: 'Règla suprimida' 462 tagging_rules_deleted: 'Règla suprimida'
458 user_added: 'Utilizaire "%username%" apondut' 463 user_added: 'Utilizaire "%username%" ajustat'
459 rss_token_updated: 'Geton RSS mes a jorn' 464 rss_token_updated: 'Geton RSS mes a jorn'
460 entry: 465 entry:
461 notice: 466 notice:
@@ -467,12 +472,12 @@ flashes:
467 entry_reloaded_failed: "L'article es estat cargat de nĂ²u mai la recuperacion del contengut a fracassat" 472 entry_reloaded_failed: "L'article es estat cargat de nĂ²u mai la recuperacion del contengut a fracassat"
468 entry_archived: 'Article marcat coma legit' 473 entry_archived: 'Article marcat coma legit'
469 entry_unarchived: 'Article marcat coma pas legit' 474 entry_unarchived: 'Article marcat coma pas legit'
470 entry_starred: 'Article apondut dins los favorits' 475 entry_starred: 'Article ajustat dins los favorits'
471 entry_unstarred: 'Article quitat dels favorits' 476 entry_unstarred: 'Article quitat dels favorits'
472 entry_deleted: 'Article suprimit' 477 entry_deleted: 'Article suprimit'
473 tag: 478 tag:
474 notice: 479 notice:
475 tag_added: 'Etiqueta aponduda' 480 tag_added: 'Etiqueta ajustada'
476 import: 481 import:
477 notice: 482 notice:
478 failed: "L'importacion a fracassat, mercés de tornar ensajar" 483 failed: "L'importacion a fracassat, mercés de tornar ensajar"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 392f9c19..a2fe13db 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Nazwa' 88 name_label: 'Nazwa'
89 email_label: 'Adres email' 89 email_label: 'Adres email'
90 twoFactorAuthentication_label: 'Autoryzacja dwuetapowa' 90 twoFactorAuthentication_label: 'Autoryzacja dwuetapowa'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Stare hasło' 97 old_password_label: 'Stare hasło'
93 new_password_label: 'Nowe hasło' 98 new_password_label: 'Nowe hasło'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 152d5020..29db9c3e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Nume' 88 name_label: 'Nume'
89 email_label: 'E-mail' 89 email_label: 'E-mail'
90 # twoFactorAuthentication_label: 'Two factor authentication' 90 # twoFactorAuthentication_label: 'Two factor authentication'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Parola veche' 97 old_password_label: 'Parola veche'
93 new_password_label: 'Parola nouă' 98 new_password_label: 'Parola nouă'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index a2eca59b..41e8e576 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -88,6 +88,11 @@ config:
88 name_label: 'Ä°sim' 88 name_label: 'Ä°sim'
89 email_label: 'E-posta' 89 email_label: 'E-posta'
90 twoFactorAuthentication_label: 'İki adımlı doğrulama' 90 twoFactorAuthentication_label: 'İki adımlı doğrulama'
91 delete:
92 # title: Delete my account (danger zone !)
93 # 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.
94 # confirm: Are you really sure? (it can't be UNDONE)
95 # button: Delete my account
91 form_password: 96 form_password:
92 old_password_label: 'Eski ÅŸifre' 97 old_password_label: 'Eski ÅŸifre'
93 new_password_label: 'Yeni ÅŸifre' 98 new_password_label: 'Yeni ÅŸifre'
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 ff7ef73a..54508b6d 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
@@ -150,6 +150,15 @@
150 {{ form_widget(form.user.save) }} 150 {{ form_widget(form.user.save) }}
151 </form> 151 </form>
152 152
153 {% if enabled_users > 1 %}
154 <h2>{{ 'config.form_user.delete.title'|trans }}</h2>
155
156 <p>{{ 'config.form_user.delete.description'|trans }}</p>
157 <a href="{{ path('delete_account') }}" onclick="return confirm('{{ 'config.form_user.delete.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red delete-account">
158 {{ 'config.form_user.delete.button'|trans }}
159 </a>
160 {% endif %}
161
153 <h2>{{ 'config.tab_menu.password'|trans }}</h2> 162 <h2>{{ 'config.tab_menu.password'|trans }}</h2>
154 163
155 {{ form_start(form.pwd) }} 164 {{ form_start(form.pwd) }}
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 270c077f..8434508d 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
@@ -167,6 +167,18 @@
167 {{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} 167 {{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
168 {{ form_widget(form.user._token) }} 168 {{ form_widget(form.user._token) }}
169 </form> 169 </form>
170
171 {% if enabled_users > 1 %}
172 <br /><hr /><br />
173
174 <div class="row">
175 <h5>{{ 'config.form_user.delete.title'|trans }}</h5>
176 <p>{{ 'config.form_user.delete.description'|trans }}</p>
177 <a href="{{ path('delete_account') }}" onclick="return confirm('{{ 'config.form_user.delete.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red delete-account">
178 {{ 'config.form_user.delete.button'|trans }}
179 </a>
180 </div>
181 {% endif %}
170 </div> 182 </div>
171 183
172 <div id="set4" class="col s12"> 184 <div id="set4" class="col s12">
diff --git a/src/Wallabag/UserBundle/Repository/UserRepository.php b/src/Wallabag/UserBundle/Repository/UserRepository.php
index 009c4881..445edb3c 100644
--- a/src/Wallabag/UserBundle/Repository/UserRepository.php
+++ b/src/Wallabag/UserBundle/Repository/UserRepository.php
@@ -38,4 +38,18 @@ class UserRepository extends EntityRepository
38 ->getQuery() 38 ->getQuery()
39 ->getSingleResult(); 39 ->getSingleResult();
40 } 40 }
41
42 /**
43 * Count how many users are enabled.
44 *
45 * @return int
46 */
47 public function getSumEnabledUsers()
48 {
49 return $this->createQueryBuilder('u')
50 ->select('count(u)')
51 ->andWhere('u.expired = false')
52 ->getQuery()
53 ->getSingleScalarResult();
54 }
41} 55}
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index 1954c654..5faa0130 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -3,6 +3,8 @@
3namespace Tests\Wallabag\CoreBundle\Controller; 3namespace Tests\Wallabag\CoreBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Wallabag\CoreBundle\Entity\Config;
7use Wallabag\UserBundle\Entity\User;
6 8
7class ConfigControllerTest extends WallabagCoreTestCase 9class ConfigControllerTest extends WallabagCoreTestCase
8{ 10{
@@ -570,4 +572,122 @@ class ConfigControllerTest extends WallabagCoreTestCase
570 $config->set('demo_mode_enabled', 0); 572 $config->set('demo_mode_enabled', 0);
571 $config->set('demo_mode_username', 'wallabag'); 573 $config->set('demo_mode_username', 'wallabag');
572 } 574 }
575
576 public function testDeleteUserButtonVisibility()
577 {
578 $this->logInAs('admin');
579 $client = $this->getClient();
580
581 $crawler = $client->request('GET', '/config');
582
583 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
584 $this->assertContains('config.form_user.delete.button', $body[0]);
585
586 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
587
588 $user = $em
589 ->getRepository('WallabagUserBundle:User')
590 ->findOneByUsername('empty');
591 $user->setExpired(1);
592 $em->persist($user);
593
594 $user = $em
595 ->getRepository('WallabagUserBundle:User')
596 ->findOneByUsername('bob');
597 $user->setExpired(1);
598 $em->persist($user);
599
600 $em->flush();
601
602 $crawler = $client->request('GET', '/config');
603
604 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
605 $this->assertNotContains('config.form_user.delete.button', $body[0]);
606
607 $client->request('GET', '/account/delete');
608 $this->assertEquals(403, $client->getResponse()->getStatusCode());
609
610 $user = $em
611 ->getRepository('WallabagUserBundle:User')
612 ->findOneByUsername('empty');
613 $user->setExpired(0);
614 $em->persist($user);
615
616 $user = $em
617 ->getRepository('WallabagUserBundle:User')
618 ->findOneByUsername('bob');
619 $user->setExpired(0);
620 $em->persist($user);
621
622 $em->flush();
623 }
624
625 public function testDeleteAccount()
626 {
627 $client = $this->getClient();
628 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
629
630 $user = new User();
631 $user->setName('Wallace');
632 $user->setEmail('wallace@wallabag.org');
633 $user->setUsername('wallace');
634 $user->setPlainPassword('wallace');
635 $user->setEnabled(true);
636 $user->addRole('ROLE_SUPER_ADMIN');
637
638 $em->persist($user);
639
640 $config = new Config($user);
641
642 $config->setTheme('material');
643 $config->setItemsPerPage(30);
644 $config->setReadingSpeed(1);
645 $config->setLanguage('en');
646 $config->setPocketConsumerKey('xxxxx');
647
648 $em->persist($config);
649 $em->flush();
650
651 $this->logInAs('wallace');
652 $loggedInUserId = $this->getLoggedInUserId();
653
654 // create entry to check after user deletion
655 // that this entry is also deleted
656 $crawler = $client->request('GET', '/new');
657
658 $this->assertEquals(200, $client->getResponse()->getStatusCode());
659
660 $form = $crawler->filter('form[name=entry]')->form();
661 $data = [
662 'entry[url]' => $url = 'https://github.com/wallabag/wallabag',
663 ];
664
665 $client->submit($form, $data);
666 $this->assertEquals(302, $client->getResponse()->getStatusCode());
667
668 $crawler = $client->request('GET', '/config');
669
670 $deleteLink = $crawler->filter('.delete-account')->last()->link();
671
672 $client->click($deleteLink);
673 $this->assertEquals(302, $client->getResponse()->getStatusCode());
674
675 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
676 $user = $em
677 ->getRepository('WallabagUserBundle:User')
678 ->createQueryBuilder('u')
679 ->where('u.username = :username')->setParameter('username', 'wallace')
680 ->getQuery()
681 ->getOneOrNullResult()
682 ;
683
684 $this->assertNull($user);
685
686 $entries = $client->getContainer()
687 ->get('doctrine.orm.entity_manager')
688 ->getRepository('WallabagCoreBundle:Entry')
689 ->findByUser($loggedInUserId);
690
691 $this->assertEmpty($entries);
692 }
573} 693}