aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller/ConfigController.php
diff options
context:
space:
mode:
authorJeremy <jeremy.benoist@gmail.com>2015-02-22 09:30:25 +0100
committerJeremy <jeremy.benoist@gmail.com>2015-02-22 09:30:25 +0100
commite4977b8a866f84f65f08c55c050a62f40170fdbf (patch)
treef42886d6691d18ad8860b3ee2565f857204c7857 /src/Wallabag/CoreBundle/Controller/ConfigController.php
parentc0d9eba07f40a52bdfcfca3e7a926163b17d83ab (diff)
downloadwallabag-e4977b8a866f84f65f08c55c050a62f40170fdbf.tar.gz
wallabag-e4977b8a866f84f65f08c55c050a62f40170fdbf.tar.zst
wallabag-e4977b8a866f84f65f08c55c050a62f40170fdbf.zip
Adding new user
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/ConfigController.php')
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index b3236e3c..aedbc999 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -6,9 +6,11 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller; 6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request; 7use Symfony\Component\HttpFoundation\Request;
8use Wallabag\CoreBundle\Entity\Config; 8use Wallabag\CoreBundle\Entity\Config;
9use Wallabag\CoreBundle\Entity\User;
9use Wallabag\CoreBundle\Form\Type\ConfigType; 10use Wallabag\CoreBundle\Form\Type\ConfigType;
10use Wallabag\CoreBundle\Form\Type\ChangePasswordType; 11use Wallabag\CoreBundle\Form\Type\ChangePasswordType;
11use Wallabag\CoreBundle\Form\Type\UserType; 12use Wallabag\CoreBundle\Form\Type\UserType;
13use Wallabag\CoreBundle\Form\Type\NewUserType;
12 14
13class ConfigController extends Controller 15class ConfigController extends Controller
14{ 16{
@@ -72,10 +74,28 @@ class ConfigController extends Controller
72 return $this->redirect($this->generateUrl('config')); 74 return $this->redirect($this->generateUrl('config'));
73 } 75 }
74 76
77 // handle adding new user
78 $newUser = new User();
79 $newUserForm = $this->createForm(new NewUserType(), $newUser);
80 $newUserForm->handleRequest($request);
81
82 if ($newUserForm->isValid()) {
83 $em->persist($newUser);
84 $em->flush();
85
86 $this->get('session')->getFlashBag()->add(
87 'notice',
88 sprintf('User "%s" added', $newUser->getUsername())
89 );
90
91 return $this->redirect($this->generateUrl('config'));
92 }
93
75 return $this->render('WallabagCoreBundle:Config:index.html.twig', array( 94 return $this->render('WallabagCoreBundle:Config:index.html.twig', array(
76 'configForm' => $configForm->createView(), 95 'configForm' => $configForm->createView(),
77 'pwdForm' => $pwdForm->createView(), 96 'pwdForm' => $pwdForm->createView(),
78 'userForm' => $userForm->createView(), 97 'userForm' => $userForm->createView(),
98 'newUserForm' => $newUserForm->createView(),
79 )); 99 ));
80 } 100 }
81 101