Upon investigation, Chris and I have found a way that works with the
current codebase.
Ordinarily, you can pass $continue = true to continue execution. Ex.
public function action_user_authenticate_successful($user) {
Utils::redirect('http://foo.bar', true);
}
The issue is that userhandler actually sends a subsequent redirect
which will override that. Thankfully, there is a hook for that
redirect ("filter_login_redirect_dest"), allowing it to be changed. Ex.
public function filter_login_redirect_dest($login_dest, $user,
$login_session) {
return 'http://foo.bar';
}
Glad we could get that sorted out.
On Jun 4, 2009, at 4:22 PM, Chris J. Davis wrote:
>
> I want to redirect them after they have successfully authenticated and
> there is a session for them, not before. In my case I want to have
> them login and be sent back to home, not to the admin area. If If the
> plugin fires before remember() is called, there is no session.
>
> On Jun 4, 2009, at 3:20 PM, Arthus Erea wrote:
>
>>
>> Right, but I still don't see how that would prevent you from
>> redirecting the user.
>>
>> On Jun 4, 2009, at 4:05 PM, Chris J. Davis wrote:
>>
>>>
>>> Because you aren't logged in until you are remembered.
>>>
>>> On Jun 4, 2009, at 3:02 PM, Arthus Erea wrote:
>>>
>>>>
>>>> Using the current method, a plugin could potentially force the user
>>>> to
>>>> not be remembered.
>>>>
>>>> However, there are already other hooks for that functionality so it
>>>> seems like a fine change. But I'm still not sure it's needed. Why
>>>> can't one do the redirect above the $user->remember() call?
>>>>
>>>> +1
>>>>
>>>> On Jun 4, 2009, at 3:30 PM, Chris J. Davis wrote:
>>>>
>>>>>
>>>>> I would like to propose moving this call:
>>>>>
>>>>> Plugins::act( 'user_authenticate_successful', self::$identity );
>>>>>
>>>>> found on line 283 of the user class to just after $user-
>>>>> >remember()
>>>>> found on line 286. This will allow plugins to dictate arbitrary
>>>>> pages
>>>>> for the now logged in user to be redirected to. We currently have
>>>>> this:
>>>>>
>>>>> self::$identity = $user;
>>>>> Plugins::act( 'user_authenticate_successful', self::$identity );
>>>>> EventLog::log( sprintf(_t('Successful login for %s'), $user-
>>>>>> username), 'info', 'authentication', 'habari' );
>>>>> // set the cookie
>>>>> $user->remember();
>>>>> return self::$identity;
>>>>>
>>>>> And I would like to have this instead:
>>>>>
>>>>> self::$identity = $user;
>>>>> EventLog::log( sprintf(_t('Successful login for %s'), $user-
>>>>>> username), 'info', 'authentication', 'habari' );
>>>>> // set the cookie
>>>>> $user->remember();
>>>>> Plugins::act( 'user_authenticate_successful', self::$identity );
>>>>> return self::$identity;
>>>>>
>>>>> Are there any issues I am missing with this change?
>>>>>
>>>>> Chris
>>>>>
>>>>>>
>>>>
>>>>
>>>>>
>>>
>>>
>>>>
>>
>>
>>>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev
-~----------~----~----~----~------~----~------~--~---