1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-21 18:11:10 +00:00

Add option to disable registration

This commit is contained in:
Thomas Citharel 2016-07-02 14:35:52 +02:00 committed by Jeremy Benoist
parent 79efca1e6f
commit de3d716ae4
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
7 changed files with 54 additions and 1 deletions

View file

@ -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);
}
}
}

View 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'))
)
);
}
}