1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-16 18:01:38 +00:00

Added check if there is only one user

Added translations and documentation
This commit is contained in:
Nicolas Lœuillet 2016-09-08 14:07:36 +02:00 committed by Jeremy Benoist
parent abb5291cd5
commit bb0c78f4a6
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
17 changed files with 50 additions and 1 deletions

View file

@ -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());