2008年10月14日星期二

Re: [fw-mvc] Plugin and Redirector

no, if go on user/login work (with the plugin disabled)

Matthew Weier O'Phinney ha scritto:
> -- angelbit <angelbit88@gmail.com> wrote
> (on Tuesday, 14 October 2008, 04:45 PM +0200):
>
>> I created a plugin to redirect the login page if dont are
>> authenticated.Now rather than redirect generates an infinite loop and
>> end with timeout.How can I do?
>>
>
> Make sure the plugin does not redirect when the controller is 'user' and
> the action is 'login'. ;)
>
>
>> The code:
>>
>>
>>> class PluginAuth extends Zend_Controller_Plugin_Abstract {
>>>
>>> function routeStartup() {
>>>
>>>
>>>
>>> $auth = Zend_Auth::getInstance();
>>> if (!$auth->hasIdentity()) {
>>>
>>>
>>> $re =
>>> Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
>>> $re->setgotoUrl('/user/login/');
>>> $re->gotoUrl();
>>> }
>>>
>>> }
>>>
>>>
>>>
>>>
>>> }
>>>
>> PS:sorry for my english are italian
>>
>>
>
>

没有评论: