Added config setting to disable password-reset and user-registration (#261)

This commit is contained in:
Kevin Papst
2018-08-09 20:44:49 +02:00
committed by GitHub
parent 39ea44fdc3
commit 3dcd38eca7
13 changed files with 230 additions and 53 deletions

View File

@@ -71,12 +71,42 @@ class Kernel extends BaseKernel
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$confDir = $this->getProjectDir() . '/config';
// some routes are based on app configs and will be imported manually
$this->configureFosUserRoutes($routes);
// load bundle specific route files
if (is_dir($confDir . '/routes/')) {
$routes->import($confDir . '/routes/*' . self::CONFIG_EXTS, '/', 'glob');
}
// load environment specific route files
if (is_dir($confDir . '/routes/' . $this->environment)) {
$routes->import($confDir . '/routes/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
}
// load application routes
$routes->import($confDir . '/routes' . self::CONFIG_EXTS, '/', 'glob');
}
protected function configureFosUserRoutes(RouteCollectionBuilder $routes)
{
$features = $this->getContainer()->getParameter('kimai.fosuser');
// Expose the user registration feature
if ($features['registration']) {
$routes->import(
'@FOSUserBundle/Resources/config/routing/registration.xml',
'/{_locale}/register'
);
}
// Expose the users password-reset feature
if ($features['password_reset']) {
$routes->import(
'@FOSUserBundle/Resources/config/routing/resetting.xml',
'/{_locale}/resetting'
);
}
}
}