mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-05 16:39:49 +00:00
Added check if there is only one user
Added translations and documentation
This commit is contained in:
parent
abb5291cd5
commit
bb0c78f4a6
17 changed files with 50 additions and 1 deletions
|
@ -50,6 +50,8 @@ User information
|
|||
|
||||
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
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ Mon compte
|
|||
|
||||
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)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|||
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;
|
||||
|
@ -148,6 +149,9 @@ class ConfigController extends Controller
|
|||
'token' => $config->getRssToken(),
|
||||
],
|
||||
'twofactor_auth' => $this->getParameter('twofactor_auth'),
|
||||
'enabled_users' => $this->getDoctrine()
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->getSumEnabledUsers(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -257,10 +261,20 @@ class ConfigController extends Controller
|
|||
*
|
||||
* @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());
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
name_label: 'نام'
|
||||
email_label: 'نشانی ایمیل'
|
||||
twoFactorAuthentication_label: 'تأیید ۲مرحلهای'
|
||||
# delete_account: 'Delete my account'
|
||||
form_password:
|
||||
old_password_label: 'رمز قدیمی'
|
||||
new_password_label: 'رمز تازه'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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ă'
|
||||
|
|
|
@ -88,6 +88,7 @@ config:
|
|||
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'
|
||||
|
|
|
@ -148,6 +148,9 @@
|
|||
|
||||
{{ 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>
|
||||
|
|
|
@ -167,7 +167,10 @@
|
|||
{{ 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">
|
||||
|
|
|
@ -38,4 +38,18 @@ class UserRepository extends EntityRepository
|
|||
->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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue