Bläddra i källkod

Possibilité de reset les tokens (admin)

François 6 år sedan
förälder
incheckning
fead1fbe03
2 ändrade filer med 16 tillägg och 0 borttagningar
  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');
+    }
 }