Feature #51238
closedadd hook in logout process
Added by Kay Strobach over 11 years ago. Updated about 9 years ago.
0%
Description
would be nice to have a hook similar to http://typo3.org/extensions/repository/view/ksbelogout directly in the core to avoid the xclassing
the linked extension is used to redirect the user after logout.
Updated by Ernesto Baschny over 11 years ago
- Status changed from New to Accepted
Sounds easy. Good idea.
Updated by Nicole Cordes over 11 years ago
- Status changed from Accepted to Needs Feedback
There is already a hook for that?
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'])) { $_params = array(); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'] as $_funcRef) { if ($_funcRef) { GeneralUtility::callUserFunction($_funcRef, $_params, $this); } } }
\typo3\sysext\core\Classes\Authentication\AbstractUserAuthentication.php line 958
Updated by Morten Haggren over 11 years ago
Nicole Cordes wrote:
There is already a hook for that?
[...]
\typo3\sysext\core\Classes\Authentication\AbstractUserAuthentication.php line 958
That hook is called multiple times per page view for front end and backend users alike - what is needed is a hook to identofy when a backend user wants to log out, not as is the case with the hook you listed one that is called when a page is done rendering.
(Sendt from a cellphone so pardon the spelling errors)
Updated by Ernesto Baschny about 11 years ago
- Target version deleted (
6.2.0)
Indeed the hook is somehow bogus anyway, as the "logoff()" method is called in every session that has no user logged in. This is why it is called in every request in the frontend (if there is no user logged in).
The "postprocess" hook is also not the right one, as $this->user is unset at this point. The correct one would be logoff_pre_processing which is called still with the username set.
You can still use this hook, but inside your hook implementation you must check the passed on $this object to see if there is a $this->user set and if you are dealing with a backend logoff (and not a frontend logoff). Just return nothing if you are not in one of this two situations.
Does that solve the problem for you?
Updated by Morten Haggren about 11 years ago
Ernesto Baschny wrote:
Indeed the hook is somehow bogus anyway, as the "logoff()" method is called in every session that has no user logged in. This is why it is called in every request in the frontend (if there is no user logged in).
The "postprocess" hook is also not the right one, as $this->user is unset at this point. The correct one would be logoff_pre_processing which is called still with the username set.
You can still use this hook, but inside your hook implementation you must check the passed on $this object to see if there is a $this->user set and if you are dealing with a backend logoff (and not a frontend logoff). Just return nothing if you are not in one of this two situations.
Does that solve the problem for you?
Firstly, apologies for the late answer.
Secondly, I've tried using that hook also - but ultimately I found out that I needed to divert the redirect after logout aswell, in my case because /typo3/ will instantly set the 'be_user' cookie when it's called regardless of login state - (I'm trying to remove this cookie for cache reasons when NOT logged into the backend)
Updated by Kay Strobach about 11 years ago
@ernesto, does my xlass work for you? - if yes, we can use the same hook :D
Updated by Ernesto Baschny about 11 years ago
Could you simply suggest the hook you want in form of a review request? That would probably make it easier to understand what's currently missing in the available two hooks.
Thanks!
Updated by Kay Strobach about 11 years ago
currently i do not have the time to do so, but it's as easy as done in the xclass:
function SC_logout::logout end of function
The classname may have changed since 4.5 LTS
Updated by Morten Haggren about 11 years ago
Ernesto Baschny wrote:
Could you simply suggest the hook you want in form of a review request? That would probably make it easier to understand what's currently missing in the available two hooks.
Thanks!
Not sure what a 'review request' is specifically but here is the suggested hook as it would look in 6.2 LTS
Class : TYPO3\\CMS\\Backend\\Controller\\LogoutController
File : /typo3/sysext/backend/Classes/Controller/LogoutController.php
Function: logout
Hook would go in just before line 52:
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
The hook should receive the current redirectUrl and it's return value override it, this would allow us to perform actions when typo3 has performed every action it believes is needed to log out as well as redirect the user to a page of our own choosing.
I hope this clarifies things
Updated by Alexander Opitz almost 11 years ago
- Status changed from Needs Feedback to New
Updated by Mathias Schreiber almost 10 years ago
- Status changed from New to Needs Feedback
- Assignee set to Mathias Schreiber
Hey Kay,
care to send a patch?
Updated by Alexander Opitz about 9 years ago
- Status changed from Needs Feedback to Closed
- Assignee deleted (
Mathias Schreiber)
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.