Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
tadhgboyle committed Mar 11, 2023
1 parent c1ce07f commit c98258f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 5 deletions.
39 changes: 34 additions & 5 deletions custom/templates/DefaultRevamp/user/sessions.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<div class="ui segment">
<h3 class="ui header">
{$SESSIONS}
{if count($SESSIONS_LIST) > 1}
<div class="res right floated">
{if $CAN_LOGOUT_ALL}
<div class="right floated">
<a class="ui mini negative button" href="#" data-toggle="modal" data-target="#modal-logout-all">
{$LOGOUT_OTHER_SESSIONS}
</a>
Expand Down Expand Up @@ -64,18 +64,47 @@
</div>
<div class="six wide column right aligned">
{if !$session.is_current}
<button class="ui mini negative button" href="#" data-toggle="modal" data-target="#modal-logout">
<a class="ui mini negative button" href="#" data-toggle="modal" data-target="#modal-logout-{$session.id}">
{$LOGOUT}
</button>
</a>
{/if}
</div>
</div>
</div>
{/foreach}
{$PAGINATION}
</div>
</div>
</div>
</div>

{if $CAN_LOGOUT_ALL}
<div class="ui small modal" id="modal-logout-all">
<div class="header">
{$LINK} {$provider_name|ucfirst}
</div>
<div class="content">
{$OAUTH_MESSAGES[$provider_name]['link_confirm']}
</div>
<div class="actions">
<a class="ui negative button">{$NO}</a>
<a class="ui green button" href="{$provider_data.url}">{$CONFIRM}</a>
</div>
</div>
{/if}

{foreach from=$SESSIONS_LIST item=session}
<div class="ui small modal" id="modal-logout-{$session.id}">
<div class="header">
{$LOGOUT}
</div>
<div class="content">
{$LOGOUT_CONFIRM}
</div>
<div class="actions">
<a class="ui negative button">{$NO}</a>
<a class="ui green button" href="{$BASE_URL}user/logout/{$session.id}">{$CONFIRM}</a>
</div>
</div>
{/foreach}

{include file='footer.tpl'}
11 changes: 11 additions & 0 deletions modules/Core/pages/user/sessions.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,24 @@
];
}

$can_logout_all = false;
if (count($sessions) > 1) {
$can_logout_all = true;
}
if (count($sessions) === 2) {
if ($sessions[0]->login_method === 'admin' || $sessions[1]->login_method === 'admin') {
$can_logout_all = false;
}
}

$smarty->assign([
'TOKEN' => Token::get(),
'NO' => $language->get('general', 'no'),
'YES' => $language->get('general', 'yes'),
'USER_CP' => $language->get('user', 'user_cp'),
'SESSIONS' => $language->get('general', 'sessions'),
'SESSIONS_LIST' => $sessions_list,
'CAN_LOGOUT_ALL' => $can_logout_all,
'LOGOUT' => $language->get('general', 'log_out'),
'LOGOUT_OTHER_SESSIONS' => $language->get('user', 'logout_other_sessions'),
]);
Expand Down

0 comments on commit c98258f

Please sign in to comment.