Skip to content

Commit 76defb8

Browse files
authored
Merge pull request #719 from hackerman26/bugfix/logoff-on-account-deletion
[BUGFIX] Invalidate session cookie when deleting account The deleteAction did not invalidate the fe_typo_user cookie, which caused subsequent logins with a different account to fail, as the browser sent an invalid session cookie.
2 parents 1a16378 + 738447b commit 76defb8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎Classes/Controller/EditController.php‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use TYPO3\CMS\Core\Utility\GeneralUtility;
2626
use TYPO3\CMS\Extbase\Annotation\Validate;
2727
use TYPO3\CMS\Extbase\Http\ForwardResponse;
28+
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
2829

2930
/**
3031
* Class EditController
@@ -218,6 +219,8 @@ public function deleteAction(User $user): \TYPO3\CMS\Extbase\Http\ForwardRespons
218219
$this->logUtility->log(Log::STATUS_PROFILEDELETE, $user);
219220
$this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_PROFILEDELETE));
220221
$this->userRepository->remove($user);
222+
$this->invalidateSessionCookie();
223+
221224
return $this->redirectByAction('delete', 'redirect', 'edit');
222225
}
223226

@@ -250,4 +253,12 @@ protected function getArgumentMissingFallbackActions(): array
250253
'delete' => 'edit',
251254
];
252255
}
256+
257+
protected function invalidateSessionCookie()
258+
{
259+
$frontendUser = $this->request->getAttribute('frontend.user');
260+
if ($frontendUser instanceof FrontendUserAuthentication) {
261+
$frontendUser->logoff();
262+
}
263+
}
253264
}

0 commit comments

Comments
 (0)