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/Controller/ConfigController.php14
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig3
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig5
-rw-r--r--src/Wallabag/UserBundle/Repository/UserRepository.php14
17 files changed, 50 insertions, 1 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/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 3cafd1bc..70a641f7 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
@@ -257,10 +261,20 @@ class ConfigController extends Controller
257 * 261 *
258 * @Route("/account/delete", name="delete_account") 262 * @Route("/account/delete", name="delete_account")
259 * 263 *
264 * @throws AccessDeniedHttpException
265 *
260 * @return \Symfony\Component\HttpFoundation\RedirectResponse 266 * @return \Symfony\Component\HttpFoundation\RedirectResponse
261 */ 267 */
262 public function deleteAccountAction() 268 public function deleteAccountAction()
263 { 269 {
270 $enabledUsers = $this->getDoctrine()
271 ->getRepository('WallabagUserBundle:User')
272 ->getSumEnabledUsers();
273
274 if ($enabledUsers <= 1) {
275 throw new AccessDeniedHttpException();
276 }
277
264 $em = $this->get('fos_user.user_manager'); 278 $em = $this->get('fos_user.user_manager');
265 $em->deleteUser($this->getUser()); 279 $em->deleteUser($this->getUser());
266 280
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 69bfe7b3..4c412592 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Gammel adgangskode' 93 old_password_label: 'Gammel adgangskode'
93 new_password_label: 'Ny adgangskode' 94 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 f4d13442..99b79bce 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Altes Kennwort' 93 old_password_label: 'Altes Kennwort'
93 new_password_label: 'Neues Kennwort' 94 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 6ddb38a0..94144ed4 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Current password' 93 old_password_label: 'Current password'
93 new_password_label: 'New password' 94 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 05b03938..a5e8d722 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Contraseña actual' 93 old_password_label: 'Contraseña actual'
93 new_password_label: 'Nueva contraseña' 94 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 3a01a8ed..4b8d9689 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -88,6 +88,7 @@ config:
88 name_label: 'نام' 88 name_label: 'نام'
89 email_label: 'نشانی ایمیل' 89 email_label: 'نشانی ایمیل'
90 twoFactorAuthentication_label: 'تأیید ۲مرحله‌ای' 90 twoFactorAuthentication_label: 'تأیید ۲مرحله‌ای'
91 # delete_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'رمز قدیمی' 93 old_password_label: 'رمز قدیمی'
93 new_password_label: 'رمز تازه' 94 new_password_label: 'رمز تازه'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 09445836..67cd5f0e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -88,6 +88,7 @@ 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_account: 'Supprimer mon compte'
91 form_password: 92 form_password:
92 old_password_label: 'Mot de passe actuel' 93 old_password_label: 'Mot de passe actuel'
93 new_password_label: 'Nouveau mot de passe' 94 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 93a11aee..55d961f3 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Password corrente' 93 old_password_label: 'Password corrente'
93 new_password_label: 'Nuova password' 94 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 8cadf9a3..5c6b4247 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Senhal actual' 93 old_password_label: 'Senhal actual'
93 new_password_label: 'Senhal novèl' 94 new_password_label: 'Senhal novèl'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index d392272f..be966427 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Stare hasło' 93 old_password_label: 'Stare hasło'
93 new_password_label: 'Nowe hasło' 94 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 f2bce442..1e52cf0b 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Parola veche' 93 old_password_label: 'Parola veche'
93 new_password_label: 'Parola nouă' 94 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 d2bf0504..ef5477e1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -88,6 +88,7 @@ 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_account: 'Delete my account'
91 form_password: 92 form_password:
92 old_password_label: 'Eski şifre' 93 old_password_label: 'Eski şifre'
93 new_password_label: 'Yeni şifre' 94 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..29575272 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
@@ -148,6 +148,9 @@
148 148
149 {{ form_widget(form.user._token) }} 149 {{ form_widget(form.user._token) }}
150 {{ form_widget(form.user.save) }} 150 {{ form_widget(form.user.save) }}
151 {% if enabled_users > 1 %}
152 <a class='btn red' href='{{ path('delete_account') }}'>{{ 'config.form_user.delete_account' | trans }}</a>
153 {% endif %}
151 </form> 154 </form>
152 155
153 <h2>{{ 'config.tab_menu.password'|trans }}</h2> 156 <h2>{{ 'config.tab_menu.password'|trans }}</h2>
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 cebde1ac..5aa3eabe 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,7 +167,10 @@
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 <a class='btn red' href='{{ path('delete_account') }}'>{{ 'config.user.delete_account' | trans }}</a> 170
171 {% if enabled_users > 1 %}
172 <a class='btn red' href='{{ path('delete_account') }}'>{{ 'config.form_user.delete_account' | trans }}</a>
173 {% endif %}
171 </div> 174 </div>
172 175
173 <div id="set4" class="col s12"> 176 <div id="set4" class="col s12">
diff --git a/src/Wallabag/UserBundle/Repository/UserRepository.php b/src/Wallabag/UserBundle/Repository/UserRepository.php
index 009c4881..178761e6 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 = 0')
52 ->getQuery()
53 ->getSingleScalarResult();
54 }
41} 55}