]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/DeveloperController.php
Added name on client
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / DeveloperController.php
index 71065534e198dd863ae8614cde1a6f366e39e91c..1ea220e52edc164d5321aa0207c30875f30fb181 100644 (file)
@@ -21,9 +21,9 @@ class DeveloperController extends Controller
     {
         $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll();
 
-        return $this->render('WallabagCoreBundle:Developer:index.html.twig', array(
+        return $this->render('WallabagCoreBundle:Developer:index.html.twig', [
             'clients' => $clients,
-        ));
+        ]);
     }
 
     /**
@@ -43,24 +43,25 @@ class DeveloperController extends Controller
         $clientForm->handleRequest($request);
 
         if ($clientForm->isValid()) {
-            $client->setAllowedGrantTypes(array('token', 'authorization_code', 'password'));
+            $client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']);
             $em->persist($client);
             $em->flush();
 
             $this->get('session')->getFlashBag()->add(
                 'notice',
-                'New client created.'
+                $this->get('translator')->trans('flashes.developer.notice.client_created', array('%name%' => $client->getName()))
             );
 
-            return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', array(
+            return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', [
                 'client_id' => $client->getPublicId(),
                 'client_secret' => $client->getSecret(),
-            ));
+                'client_name' => $client->getName(),
+            ]);
         }
 
-        return $this->render('WallabagCoreBundle:Developer:client.html.twig', array(
+        return $this->render('WallabagCoreBundle:Developer:client.html.twig', [
             'form' => $clientForm->createView(),
-        ));
+        ]);
     }
 
     /**
@@ -80,7 +81,7 @@ class DeveloperController extends Controller
 
         $this->get('session')->getFlashBag()->add(
             'notice',
-            'Client deleted'
+            $this->get('translator')->trans('flashes.developer.notice.client_deleted', array('%name%' => $client->getName()))
         );
 
         return $this->redirect($this->generateUrl('developer'));