You can change your name, your email address and enable ``Two factor authentication``.
+If the wallabag instance has more than one enabled user, you can delete your account here. **Take care, we delete all your data**.
+
Two factor authentication
~~~~~~~~~~~~~~~~~~~~~~~~~
Vous pouvez ici modifier votre nom, votre adresse email et activer la ``Double authentification``.
+Si l'instance de wallabag compte plus d'un utilisateur actif, vous pouvez supprimer ici votre compte. **Attention, nous supprimons toutes vos données**.
+
Double authentification (2FA)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\TaggingRule;
use Wallabag\CoreBundle\Form\Type\ConfigType;
'token' => $config->getRssToken(),
],
'twofactor_auth' => $this->getParameter('twofactor_auth'),
+ 'enabled_users' => $this->getDoctrine()
+ ->getRepository('WallabagUserBundle:User')
+ ->getSumEnabledUsers(),
]);
}
*
* @Route("/account/delete", name="delete_account")
*
+ * @throws AccessDeniedHttpException
+ *
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function deleteAccountAction()
{
+ $enabledUsers = $this->getDoctrine()
+ ->getRepository('WallabagUserBundle:User')
+ ->getSumEnabledUsers();
+
+ if ($enabledUsers <= 1) {
+ throw new AccessDeniedHttpException();
+ }
+
$em = $this->get('fos_user.user_manager');
$em->deleteUser($this->getUser());
name_label: 'Navn'
email_label: 'Emailadresse'
# twoFactorAuthentication_label: 'Two factor authentication'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'Gammel adgangskode'
new_password_label: 'Ny adgangskode'
name_label: 'Name'
email_label: 'E-Mail-Adresse'
twoFactorAuthentication_label: 'Zwei-Faktor-Authentifizierung'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'Altes Kennwort'
new_password_label: 'Neues Kennwort'
name_label: 'Name'
email_label: 'Email'
twoFactorAuthentication_label: 'Two factor authentication'
+ delete_account: 'Delete my account'
form_password:
old_password_label: 'Current password'
new_password_label: 'New password'
name_label: 'Nombre'
email_label: 'Direccion e-mail'
twoFactorAuthentication_label: 'Autentificación de dos factores'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'Contraseña actual'
new_password_label: 'Nueva contraseña'
name_label: 'نام'
email_label: 'نشانی ایمیل'
twoFactorAuthentication_label: 'تأیید ۲مرحلهای'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'رمز قدیمی'
new_password_label: 'رمز تازه'
name_label: 'Nom'
email_label: 'Adresse e-mail'
twoFactorAuthentication_label: 'Double authentification'
+ delete_account: 'Supprimer mon compte'
form_password:
old_password_label: 'Mot de passe actuel'
new_password_label: 'Nouveau mot de passe'
name_label: 'Nome'
email_label: 'E-mail'
twoFactorAuthentication_label: 'Two factor authentication'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'Password corrente'
new_password_label: 'Nuova password'
name_label: 'Nom'
email_label: 'Adreça de corrièl'
twoFactorAuthentication_label: 'Dobla autentificacion'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'Senhal actual'
new_password_label: 'Senhal novèl'
name_label: 'Nazwa'
email_label: 'Adres email'
twoFactorAuthentication_label: 'Autoryzacja dwuetapowa'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'Stare hasło'
new_password_label: 'Nowe hasło'
name_label: 'Nume'
email_label: 'E-mail'
# twoFactorAuthentication_label: 'Two factor authentication'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'Parola veche'
new_password_label: 'Parola nouă'
name_label: 'İsim'
email_label: 'E-posta'
twoFactorAuthentication_label: 'İki adımlı doğrulama'
+ # delete_account: 'Delete my account'
form_password:
old_password_label: 'Eski şifre'
new_password_label: 'Yeni şifre'
{{ form_widget(form.user._token) }}
{{ form_widget(form.user.save) }}
+ {% if enabled_users > 1 %}
+ <a class='btn red' href='{{ path('delete_account') }}'>{{ 'config.form_user.delete_account' | trans }}</a>
+ {% endif %}
</form>
<h2>{{ 'config.tab_menu.password'|trans }}</h2>
{{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
{{ form_widget(form.user._token) }}
</form>
- <a class='btn red' href='{{ path('delete_account') }}'>{{ 'config.user.delete_account' | trans }}</a>
+
+ {% if enabled_users > 1 %}
+ <a class='btn red' href='{{ path('delete_account') }}'>{{ 'config.form_user.delete_account' | trans }}</a>
+ {% endif %}
</div>
<div id="set4" class="col s12">
->getQuery()
->getSingleResult();
}
+
+ /**
+ * Count how many users are enabled.
+ *
+ * @return int
+ */
+ public function getSumEnabledUsers()
+ {
+ return $this->createQueryBuilder('u')
+ ->select('count(u)')
+ ->andWhere('u.expired = 0')
+ ->getQuery()
+ ->getSingleScalarResult();
+ }
}