I'm using zfcUser
and I was wondering if its possible to disable the default routes, such as zfcUser/login
, zfcUser/register
, etc because I do not want to expose them.
I looked at the zfcuser.global.php
but there seems to be no such option?
Thanks
You can simply override the configuration by setting a null controller or an unmatchable routing configuration.
Solution 1: override the zfcuser
controller invokable:
// YourApp\Module#getConfig() or config/autoload/zfcuser.override.global.php
return array(
'controllers' => array(
'invokables' => array(
'zfcuser' => null,
),
),
);
Solution 2: overriding routing configuration by using your own route config (hacky, discouraged):
// YourApp\Module#getConfig() or config/autoload/zfcuser.override.global.php
return array(
'router' => array(
'routes' => array(
'zfcuser' => array(
// changing to hostname route - using an unreachable hostname
'type' => 'Hostname',
// minimum possible priority - all other routes come first.
'priority' => ~PHP_INT_MAX,
'options' => array(
// foo.bar does not exist - never matched
'route' => 'foo.bar',
'defaults' => array(
'controller' => null,
'action' => 'index',
),
),
// optional - just if you want to override single child routes:
'child_routes' => array(
'login' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'authenticate' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'logout' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'register' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'changepassword' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'changeemail' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
),
),
),
),
);