]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/ConfigController.php
work
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / ConfigController.php
index 51d8bdd1fabfd70495d27418a016ae9a01d96a9e..0a306d57c8aa271455d915cb7da7784f60696140 100644 (file)
@@ -2,8 +2,6 @@
 
 namespace Wallabag\CoreBundle\Controller;
 
-use FOS\UserBundle\Event\UserEvent;
-use FOS\UserBundle\FOSUserEvents;
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 use Symfony\Component\HttpFoundation\JsonResponse;
@@ -253,4 +251,24 @@ class ConfigController extends Controller
 
         return $config;
     }
+
+    /**
+     * Delete account for current user.
+     *
+     * @Route("/account/delete", name="delete_account")
+     *
+     * @return \Symfony\Component\HttpFoundation\RedirectResponse
+     */
+     public function deleteAccountAction()
+     {
+         $em = $this->get('fos_user.user_manager');
+         $em->deleteUser($this->getUser());
+
+         $this->get('session')->getFlashBag()->add(
+             'notice',
+             'flashes.account.notice.account_deleted'
+         );
+
+         return $this->redirect($this->generateUrl('fos_user_security_logout'));
+     }
 }