aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/Controller
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-07-02 14:35:52 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-08-23 07:40:36 +0200
commitde3d716ae4e8ca98dabdcb2ec9c18219e05856f7 (patch)
treedc1198b88d23b81130026057ddebb1d687c643e6 /src/Wallabag/UserBundle/Controller
parent79efca1e6ff28362d4bd2713f68205294cdd07de (diff)
downloadwallabag-de3d716ae4e8ca98dabdcb2ec9c18219e05856f7.tar.gz
wallabag-de3d716ae4e8ca98dabdcb2ec9c18219e05856f7.tar.zst
wallabag-de3d716ae4e8ca98dabdcb2ec9c18219e05856f7.zip
Add option to disable registration
Diffstat (limited to 'src/Wallabag/UserBundle/Controller')
-rw-r--r--src/Wallabag/UserBundle/Controller/RegistrationController.php20
-rw-r--r--src/Wallabag/UserBundle/Controller/SecurityController.php18
2 files changed, 38 insertions, 0 deletions
diff --git a/src/Wallabag/UserBundle/Controller/RegistrationController.php b/src/Wallabag/UserBundle/Controller/RegistrationController.php
new file mode 100644
index 00000000..bba27cfb
--- /dev/null
+++ b/src/Wallabag/UserBundle/Controller/RegistrationController.php
@@ -0,0 +1,20 @@
1<?php
2
3namespace Wallabag\UserBundle\Controller;
4
5use FOS\UserBundle\Controller\RegistrationController as FOSRegistrationController;
6use Symfony\Component\HttpFoundation\Request;
7
8class RegistrationController extends FOSRegistrationController
9{
10 public function registerAction(Request $request)
11 {
12 if ($this->container->getParameter('wallabag_user.registration_enabled')) {
13 parent::registerAction($request);
14 }
15 else
16 {
17 return $this->redirectToRoute('fos_user_security_login', array(), 301);
18 }
19 }
20}
diff --git a/src/Wallabag/UserBundle/Controller/SecurityController.php b/src/Wallabag/UserBundle/Controller/SecurityController.php
new file mode 100644
index 00000000..a5f93763
--- /dev/null
+++ b/src/Wallabag/UserBundle/Controller/SecurityController.php
@@ -0,0 +1,18 @@
1<?php
2
3namespace Wallabag\UserBundle\Controller;
4
5use FOS\UserBundle\Controller\SecurityController as FOSSecurityController;
6
7class SecurityController extends FOSSecurityController
8{
9 protected function renderLogin(array $data)
10 {
11 return $this->render('FOSUserBundle:Security:login.html.twig',
12 array_merge(
13 $data,
14 array('registration_enabled' => $this->container->getParameter('wallabag_user.registration_enabled'))
15 )
16 );
17 }
18}