forked from wallabag/wallabag
Add option to disable registration
This commit is contained in:
committed by
Jeremy Benoist
parent
79efca1e6f
commit
de3d716ae4
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\UserBundle\Controller;
|
||||
|
||||
use FOS\UserBundle\Controller\RegistrationController as FOSRegistrationController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class RegistrationController extends FOSRegistrationController
|
||||
{
|
||||
public function registerAction(Request $request)
|
||||
{
|
||||
if ($this->container->getParameter('wallabag_user.registration_enabled')) {
|
||||
parent::registerAction($request);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->redirectToRoute('fos_user_security_login', array(), 301);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
src/Wallabag/UserBundle/Controller/SecurityController.php
Normal file
18
src/Wallabag/UserBundle/Controller/SecurityController.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\UserBundle\Controller;
|
||||
|
||||
use FOS\UserBundle\Controller\SecurityController as FOSSecurityController;
|
||||
|
||||
class SecurityController extends FOSSecurityController
|
||||
{
|
||||
protected function renderLogin(array $data)
|
||||
{
|
||||
return $this->render('FOSUserBundle:Security:login.html.twig',
|
||||
array_merge(
|
||||
$data,
|
||||
array('registration_enabled' => $this->container->getParameter('wallabag_user.registration_enabled'))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user