aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/Controller
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-08-24 11:13:00 +0200
committerGitHub <noreply@github.com>2016-08-24 11:13:00 +0200
commita1ab7d1d32cb69af563fcec4395fce5217f154f7 (patch)
treeffc13a611a862cce7d74bf6d349bbb2468f33049 /src/Wallabag/UserBundle/Controller
parent1bee9e0760c89756ebab0b67f9ab7efc5c6a709b (diff)
parent8541b3c4fdf35788129483060499fef50818222c (diff)
downloadwallabag-a1ab7d1d32cb69af563fcec4395fce5217f154f7.tar.gz
wallabag-a1ab7d1d32cb69af563fcec4395fce5217f154f7.tar.zst
wallabag-a1ab7d1d32cb69af563fcec4395fce5217f154f7.zip
Merge pull request #2186 from wallabag/addRegistration
Add option to disable registration
Diffstat (limited to 'src/Wallabag/UserBundle/Controller')
-rw-r--r--src/Wallabag/UserBundle/Controller/RegistrationController.php18
-rw-r--r--src/Wallabag/UserBundle/Controller/SecurityController.php21
2 files changed, 39 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..f81f3a7b
--- /dev/null
+++ b/src/Wallabag/UserBundle/Controller/RegistrationController.php
@@ -0,0 +1,18 @@
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 return parent::registerAction($request);
14 }
15
16 return $this->redirectToRoute('fos_user_security_login', [], 301);
17 }
18}
diff --git a/src/Wallabag/UserBundle/Controller/SecurityController.php b/src/Wallabag/UserBundle/Controller/SecurityController.php
new file mode 100644
index 00000000..83fa0b20
--- /dev/null
+++ b/src/Wallabag/UserBundle/Controller/SecurityController.php
@@ -0,0 +1,21 @@
1<?php
2
3namespace Wallabag\UserBundle\Controller;
4
5use FOS\UserBundle\Controller\SecurityController as FOSSecurityController;
6
7/**
8 * Extends login form in order to pass the registration_enabled parameter.
9 */
10class SecurityController extends FOSSecurityController
11{
12 protected function renderLogin(array $data)
13 {
14 return $this->render('FOSUserBundle:Security:login.html.twig',
15 array_merge(
16 $data,
17 ['registration_enabled' => $this->container->getParameter('wallabag_user.registration_enabled')]
18 )
19 );
20 }
21}