diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ConfigController.php | 43 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig | 10 |
2 files changed, 32 insertions, 21 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 70a641f7..662da2a0 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -261,28 +261,31 @@ class ConfigController extends Controller | |||
261 | * | 261 | * |
262 | * @Route("/account/delete", name="delete_account") | 262 | * @Route("/account/delete", name="delete_account") |
263 | * | 263 | * |
264 | * @param Request $request | ||
265 | * | ||
264 | * @throws AccessDeniedHttpException | 266 | * @throws AccessDeniedHttpException |
265 | * | 267 | * |
266 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | 268 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
267 | */ | 269 | */ |
268 | public function deleteAccountAction() | 270 | public function deleteAccountAction(Request $request) |
269 | { | 271 | { |
270 | $enabledUsers = $this->getDoctrine() | 272 | $enabledUsers = $this->getDoctrine() |
271 | ->getRepository('WallabagUserBundle:User') | 273 | ->getRepository('WallabagUserBundle:User') |
272 | ->getSumEnabledUsers(); | 274 | ->getSumEnabledUsers(); |
273 | 275 | ||
274 | if ($enabledUsers <= 1) { | 276 | if ($enabledUsers <= 1) { |
275 | throw new AccessDeniedHttpException(); | 277 | throw new AccessDeniedHttpException(); |
276 | } | 278 | } |
277 | 279 | ||
278 | $em = $this->get('fos_user.user_manager'); | 280 | $user = $this->getUser(); |
279 | $em->deleteUser($this->getUser()); | 281 | |
280 | 282 | // logout current user | |
281 | $this->get('session')->getFlashBag()->add( | 283 | $this->get('security.token_storage')->setToken(null); |
282 | 'notice', | 284 | $request->getSession()->invalidate(); |
283 | 'flashes.account.notice.account_deleted' | 285 | |
284 | ); | 286 | $em = $this->get('fos_user.user_manager'); |
285 | 287 | $em->deleteUser($user); | |
286 | return $this->redirect($this->generateUrl('fos_user_security_logout')); | 288 | |
287 | } | 289 | return $this->redirect($this->generateUrl('fos_user_security_login')); |
290 | } | ||
288 | } | 291 | } |
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 a8a3f9dc..25d259b8 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 | |||
@@ -169,7 +169,15 @@ | |||
169 | </form> | 169 | </form> |
170 | 170 | ||
171 | {% if enabled_users > 1 %} | 171 | {% if enabled_users > 1 %} |
172 | <a class='btn red delete-account' href='{{ path('delete_account') }}'>{{ 'config.form_user.delete_account' | trans }}</a> | 172 | <br /><hr /><br /> |
173 | |||
174 | <div class="row"> | ||
175 | <h5>{{ 'config.delete.title'|trans }}</h5> | ||
176 | <p>{{ 'config.delete.description'|trans }}</p> | ||
177 | <a href="{{ path('delete_account') }}" onclick="return confirm('{{ 'config.delete.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red delete-account"> | ||
178 | {{ 'config.form_user.delete_account' | trans }} | ||
179 | </a> | ||
180 | </div> | ||
173 | {% endif %} | 181 | {% endif %} |
174 | </div> | 182 | </div> |
175 | 183 | ||