show login token for longer period
This commit is contained in:
parent
0a8e415af8
commit
5b7f5160b2
@ -61,6 +61,6 @@
|
||||
}
|
||||
<div class="ml-auto">
|
||||
<button type="submit" class="btn btn-primary">@Model.ActionButtonLabel</button>
|
||||
<a href="#" class="btn mr-5" role="button">Close</a>
|
||||
<a href="#" class="btn mr-5" role="button" onclick="halfmoon.toggleModal('actionModal');">Close</a>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -297,6 +297,17 @@
|
||||
Icon = "oi-flag"
|
||||
});
|
||||
}
|
||||
|
||||
if (Model.LevelInt < (int)ViewBag.User.Level && Model.Online)
|
||||
{
|
||||
menuItems.Items.Add(new SideContextMenuItem
|
||||
{
|
||||
Title = "Kick",
|
||||
IsButton = true,
|
||||
Reference = "kick",
|
||||
Icon = "oi-circle-x",
|
||||
});
|
||||
}
|
||||
|
||||
if ((Model.LevelInt < (int)ViewBag.User.Level && !Model.HasActivePenalty || isTempBanned) && ViewBag.Authorized)
|
||||
{
|
||||
|
@ -139,12 +139,10 @@
|
||||
|
||||
<partial name="_LeftNavBar"/>
|
||||
|
||||
<!-- End Main Modal -->
|
||||
<div id="target_id">
|
||||
@await RenderSectionAsync("targetid", required: false)
|
||||
</div>
|
||||
|
||||
<!-- End Action Modal -->
|
||||
<div class="container-fluid content-wrapper">
|
||||
<div id="mainLoadingBar" class="progress-bar position-absolute flex-fill position-fixed z-30" style="display: none">
|
||||
<div class="progress-bar-value"></div>
|
||||
|
@ -134,7 +134,7 @@
|
||||
<span class="name">@ViewBag.Localization["WEBFRONT_ACTION_RECENT_CLIENTS"]</span>
|
||||
</a>
|
||||
</has-permission>
|
||||
<a class="sidebar-link profile-action" href="#actionModal" data-action="GenerateLoginToken" title="@ViewBag.Localization["WEBFRONT_ACTION_TOKEN"]">
|
||||
<a class="sidebar-link profile-action" href="#actionModal" data-action="GenerateLoginToken" data-response-duration="30000" title="@ViewBag.Localization["WEBFRONT_ACTION_TOKEN"]">
|
||||
<i class="oi oi-key mr-5"></i>
|
||||
<span class="name">@ViewBag.Localization["WEBFRONT_ACTION_TOKEN"]</span>
|
||||
</a>
|
||||
|
@ -60,6 +60,7 @@ function escapeHtml (string) {
|
||||
$(document).ready(function () {
|
||||
|
||||
let toastMessage = getUrlParameter('toastMessage');
|
||||
const duration = parseInt(getUrlParameter('duration'));
|
||||
|
||||
if (toastMessage) {
|
||||
toastMessage = unescape(toastMessage);
|
||||
@ -71,23 +72,28 @@ $(document).ready(function () {
|
||||
content: toastMessage,
|
||||
title: 'Success',
|
||||
alertType: 'alert-success',
|
||||
fillType: 'filled'
|
||||
fillType: 'filled',
|
||||
timeShown: duration
|
||||
});
|
||||
}
|
||||
|
||||
hideLoader();
|
||||
|
||||
$(document).off('click', '.profile-action');
|
||||
$(document).on('click', '.profile-action', function () {
|
||||
$(document).on('click', '.profile-action', function (e) {
|
||||
e.preventDefault();
|
||||
const actionType = $(this).data('action');
|
||||
const actionId = $(this).data('action-id');
|
||||
const responseDuration = $(this).data('response-duration') || 5000;
|
||||
const actionIdKey = actionId === undefined ? '' : `?id=${actionId}`;
|
||||
showLoader();
|
||||
$.get(`/Action/${actionType}Form/${actionIdKey}`)
|
||||
.done(function (response) {
|
||||
$('#actionModal .modal-message').fadeOut('fast');
|
||||
$('#actionModal .modal-message').fadeOut('fast')
|
||||
$('#actionModal').attr('data-response-duration', responseDuration);
|
||||
$('#actionModalContent').html(response);
|
||||
hideLoader();
|
||||
halfmoon.toggleModal('actionModal');
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
halfmoon.initStickyAlert({
|
||||
@ -108,6 +114,7 @@ $(document).ready(function () {
|
||||
const modal = $('#actionModal');
|
||||
const shouldRefresh = modal.data('should-refresh', modal.find('.refreshable').length !== 0);
|
||||
const data = $(this).serialize();
|
||||
const duration = modal.data('response-duration');
|
||||
showLoader();
|
||||
|
||||
$.get($(this).attr('action') + '/?' + data)
|
||||
@ -123,7 +130,7 @@ $(document).ready(function () {
|
||||
}
|
||||
catch{}
|
||||
if (shouldRefresh) {
|
||||
window.location = `${window.location.href.replace('#actionModal', '')}?toastMessage=${escape(message)}`;
|
||||
window.location = `${window.location.href.replace('#', '')}?toastMessage=${escape(message)}${duration ? `&duration=${duration}` : ''}`;
|
||||
}
|
||||
else {
|
||||
modal.modal();
|
||||
@ -164,22 +171,4 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* handle loading of recent clients
|
||||
*/
|
||||
$('#actionModal').off('action_form_received');
|
||||
$('#actionModal').on('action_form_received', function (e, actionType) {
|
||||
if (actionType === 'RecentClients') {
|
||||
const ipAddresses = $('.client-location-flag');
|
||||
$.each(ipAddresses, function (index, address) {
|
||||
$.get(`https://get.geojs.io/v1/ip/country/${(address).data('ip')}.json`, function (result) {
|
||||
const countryCode = result['country'].toLowerCase();
|
||||
if (countryCode !== 'zz') {
|
||||
$(address).css('background-image', `url('https://flagcdn.com/w80/${countryCode}.png')`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user