Skip to content

Commit

Permalink
prevent user from removing the current backend session (#5371)
Browse files Browse the repository at this point in the history
  • Loading branch information
bloep committed Oct 13, 2022
1 parent facc1a1 commit 59c7c0c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions redaxo/src/core/pages/profile.sessions.php
Expand Up @@ -4,6 +4,13 @@

$list->addColumn('remove_session', '<i class="rex-icon rex-icon-delete"></i>', 0, ['<th class="rex-table-icon"></th>', '<td class="rex-table-icon">###VALUE###</td>']);
$list->setColumnParams('remove_session', ['function' => 'remove_session', 'session_id' => '###session_id###']);
$list->setColumnFormat('remove_session', 'custom', static function () use ($list) {
// prevent removing the current session
if ($list->getValue('session_id') === session_id()) {
return '';
}
return $list->getColumnLink('remove_session', $list->getValue('remove_session'));
});
$list->addLinkAttribute('remove_session', 'data-confirm', rex_i18n::msg('confirm_remove_session'));

$list->setColumnLabel('session_id', rex_i18n::msg('session_id'));
Expand Down

0 comments on commit 59c7c0c

Please sign in to comment.