rss_limit: 50
reading_speed: 1
+wallabag_user:
+ registration_enabled: "%registration_enabled%"
+
wallabag_import:
allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain']
resource_dir: "%kernel.root_dir%/../web/uploads/import"
twofactor_sender: no-reply@wallabag.org
# fosuser stuff
+ fosuser_registration: true
fosuser_confirmation: true
from_email: no-reply@wallabag.org
--- /dev/null
+<?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);
+ }
+ }
+}
--- /dev/null
+<?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'))
+ )
+ );
+ }
+}
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('wallabag_user');
+ $rootNode
+ ->children()
+ ->booleanNode('registration_enabled')
+ ->defaultValue(true)
+ ->end()
+ ->end()
+ ;
+
return $treeBuilder;
}
}
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
+ $container->setParameter('wallabag_user.registration_enabled', $config['registration_enabled']);
}
public function getAlias()
</div>
<div class="card-action center">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
- <a href="{{ path('fos_user_registration_register') }}" class="waves-effect waves-light grey btn">{{ 'security.login.register'|trans }}</a>
+ {% if registration_enabled %}
+ <a href="{{ path('fos_user_registration_register') }}" class="waves-effect waves-light grey btn">{{ 'security.login.register'|trans }}</a>
+ {% endif %}
<button class="btn waves-effect waves-light" type="submit" name="send">
{{ 'security.login.submit'|trans }}
<i class="material-icons right">send</i>