ZfcUser Authenticate and redirect

For programming and general questions on Zend Framework

ZfcUser Authenticate and redirect

Postby bartreis on Tue Jan 08, 2013 4:18 pm

Hi guys,
i am trying to protect my pages using zfcUser in ZF2,
but when i try to redirect the page to 'user' page, where he will need to login, but i got an error:
Code: Select all
   //it enters here
   return $this->redirect()->toRoute('album');//Error line

I am using it in a .phtml page, if it is wrong to put here, where is the most correct place to put it ?
and if it is not the correct way to protect a page with a non-logged user, what is the best way?

Error Log:
Code: Select all
[Thu Jan 03 14:55:10 2013] [error] [client] PHP Fatal error:  Uncaught exception 'Zend\\ServiceManager\\Exception\\ServiceNotFoundException' with message 'Zend\\ServiceManager\\ServiceManager::get was unable to fetch or create an instance for redirect' in /var/www/kennel/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:452\nStack trace:\n#0 /var/www/kennel/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php(110): Zend\\ServiceManager\\ServiceManager->get('redirect', true)\n#1 /var/www/kennel/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(340): Zend\\ServiceManager\\AbstractPluginManager->get('redirect', NULL)\n#2 /var/www/kennel/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(359): Zend\\View\\Renderer\\PhpRenderer->plugin('redirect')\n#3 /var/www/kennel/ZendSkeletonApplication/module/Album/view/album/album/edit.phtml(8): Zend\\View\\Renderer\\PhpRenderer->__call('re in /var/www/kennel/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 452
Posts: 1
Joined: Tue Jan 08, 2013 4:07 pm

Return to Zend Framework

Who is online

Users browsing this forum: Google [Bot] and 3 guests