浏览代码

Possibilité de reset les tokens (admin)

François 6 年之前
父节点
当前提交
fead1fbe03
共有 2 个文件被更改,包括 16 次插入0 次删除
  1. 2 0
      app/Resources/views/base.html.twig
  2. 14 0
      src/AppBundle/Controller/SecurityController.php

+ 2 - 0
app/Resources/views/base.html.twig

@@ -35,6 +35,8 @@
 									<a class="dropdown-item" href="{{ path('admin_index') }}">Utilisateurs</a>
 									<div class="dropdown-divider"></div>
 									<a class="dropdown-item" href="{{ path('genre_liste') }}">Liste des genres</a>
+									<div class="dropdown-divider"></div>
+									<a class="dropdown-item" href="{{ path('admin_resettokens') }}">Reset Tokens</a>
 								</div>
 							</li>
 						</ul>

+ 14 - 0
src/AppBundle/Controller/SecurityController.php

@@ -154,4 +154,18 @@ class SecurityController extends Controller
 
     }
 
+    /**
+     * @Route("/admin/resettokens", name="admin_resettokens")
+     */
+    public function resetTokensAction()
+    {
+        $em = $this->getDoctrine()->getManager();
+        $users = $em->getRepository('AppBundle:User')->findAll();
+        foreach ($users as $user)
+        {
+            $user->setToken();
+        }
+        $em->flush();
+        return $this->redirectToRoute('admin_index');
+    }
 }