Question

I'm trying to get the zfcuser route à the root of my module. I mean i try to delete the "/user/login?..." and replace it with "/login?..." Here is the way to rename the root : http://juriansluiman.nl/en/article/117/use-3rd-party-modules-in-zend-framework-2

I tried to set "/" route for zfcuser but it doesn't works (bjyauthorizestrategy send exception). How could i route zfcuser children to get what i'm looking for ?

Was it helpful?

Solution

Part of the answer : https://github.com/ZF-Commons/ZfcUser/issues/202

Complete answer : now my code in module.config.php looks like this :

    'zfcuser' => array(
            'type' => 'Zend\Mvc\Router\Http\Literal',
            'options' => array(
                'route' => '', // the route is void isntead of default 'user'
            ),
    ),
    'zfcuser-login' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/login',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action' => 'login',
            ),
        ),
    ),
    'zfcuser-authenticate' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/authenticate',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action' => 'authenticate',
            ),
        ),
    ),
    'zfcuser-logout' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/logout',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action'     => 'logout',
            ),
        ),
    ),
    'zfcuser-register' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/register',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action'     => 'register',
            ),
        ),
    ),
    'zfcuser-changepassword' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/change-password',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action'     => 'changepassword',
            ),
        ),                        
    ),
    'zfcuser-changeemail' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/change-email',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action' => 'changeemail',
            ),
        ),                        
    ),

I also want to use custom template for login/register etc so i put this :

'view_manager' => array( 
    ...
    'template_path_stack' => array(
          // to load our module view
          'YOURMODULENAME'  => __DIR__ . '/../view', // zfcuser have to load after 
          your module in your application.config.php !!!
    ),

I hope it will be helpful ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top