show login token for longer period
This commit is contained in:
@ -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')`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user