USER_HISTORY-236 Fix the session block funcionality
This commit is contained in:
@@ -452,7 +452,7 @@ try {
|
||||
$configS = System::getSystemConfiguration('', '', config("system.workspace"));
|
||||
$activeSession = isset($configS['session_block']) ? !(int)$configS['session_block']:true;
|
||||
if ($activeSession){
|
||||
setcookie('PM-TabPrimary', 101010010, $cookieOptions);
|
||||
setcookie('LURANA-TabPrimary', 101010010, $cookieOptions);
|
||||
}
|
||||
|
||||
// Update the User's last login date
|
||||
|
||||
@@ -223,11 +223,12 @@ $flagForgotPassword = isset($oConf->aConfig['login_enableForgotPassword'])
|
||||
|
||||
$configS = System::getSystemConfiguration('', '', config("system.workspace"));
|
||||
$activeSession = isset($configS['session_block']) ? !(int)$configS['session_block'] : true;
|
||||
|
||||
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]);
|
||||
if ($activeSession) {
|
||||
setcookie('PM-TabPrimary', 101010010, $cookieOptions);
|
||||
setcookie('LURANA-TabPrimary', 101010010, $cookieOptions);
|
||||
} else {
|
||||
setcookie('PM-TabPrimary', uniqid(), $cookieOptions);
|
||||
setcookie('LURANA-TabPrimary', uniqid(), $cookieOptions);
|
||||
}
|
||||
|
||||
$oHeadPublisher->addScriptCode("var flagForgotPassword = '$flagForgotPassword';");
|
||||
|
||||
148
workflow/engine/methods/login/sessionBlock.php
Normal file
148
workflow/engine/methods/login/sessionBlock.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
// Tell the browser (and search‑engines) that the page is missing
|
||||
// – use the protocol that the client sent (HTTP/1.1, HTTP/2, …)
|
||||
|
||||
$protocol = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
|
||||
header($protocol . ' 404 Not Found');
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
// Determine if HTTPS is used
|
||||
$http = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? "https" : "http";
|
||||
|
||||
// Determine host (prefer HTTP_HOST, fallback to SERVER_NAME and SERVER_PORT)
|
||||
$host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . (isset($_SERVER['SERVER_PORT']) ? ':' . $_SERVER['SERVER_PORT'] : ''));
|
||||
|
||||
// Default URLs
|
||||
$urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login";
|
||||
$urlHome = $urlLogin;
|
||||
|
||||
// Check if 'url' parameter is set and not empty
|
||||
if (!empty($_GET['url'])) {
|
||||
$urlParts = explode('/', urldecode($_GET['url']));
|
||||
|
||||
$sysSys = '';
|
||||
$sysLang = '';
|
||||
$sysSkin = '';
|
||||
|
||||
if (isset($urlParts[1]) && preg_match('/^sys(.+)$/', $urlParts[1], $matches)) {
|
||||
$sysSys = $matches[1];
|
||||
$checkDir = PATH_DATA . "sites/" . $sysSys;
|
||||
if (!is_dir($checkDir)) {
|
||||
$sysSys = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($urlParts[2])) {
|
||||
$sysLang = $urlParts[2];
|
||||
}
|
||||
|
||||
if (isset($urlParts[3])) {
|
||||
$sysSkin = $urlParts[3];
|
||||
$checkDir = PATH_SKIN_ENGINE . $sysSkin;
|
||||
if (!is_dir($checkDir)) {
|
||||
$checkDir = PATH_CUSTOM_SKINS . $sysSkin;
|
||||
if (!is_dir($checkDir)) {
|
||||
$sysSkin = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($sysSys !== '' && $sysLang !== '' && $sysSkin !== '') {
|
||||
$urlLogin = sprintf('%s://%s/sys%s/%s/%s/login/login', $http, $host, $sysSys, $sysLang, $sysSkin);
|
||||
$urlHome = sprintf('%s://%s/sys%s/%s/%s/cases/main', $http, $host, $sysSys, $sysLang, $sysSkin);
|
||||
}
|
||||
}
|
||||
|
||||
$title = G::LoadTranslation('ID_SESSION_BLOCKED_TITLE');
|
||||
$subTitle = G::LoadTranslation('ID_SESSION_BLOCKED_SUBTITLE');
|
||||
$message = G::LoadTranslation('ID_SESSION_BLOCKED_MESSAGE');
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="robots" content="noindex,nofollow"/>
|
||||
<title><?php echo htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?></title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Verdana, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
color: #222;
|
||||
background: #eee;
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
height: 100vh;
|
||||
}
|
||||
#content {
|
||||
max-width: 800px;
|
||||
width: 100%;
|
||||
}
|
||||
h1 {
|
||||
font-size: 19px;
|
||||
background-color: #fff;
|
||||
padding: 15px 28px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 12px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
h2 {
|
||||
margin: 0 0 0 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
.block {
|
||||
background-color: #fff;
|
||||
padding: 15px 28px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 0 0 12px 12px;
|
||||
white-space: pre-line;
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
.block_exception {
|
||||
background-color: #ddd;
|
||||
color: #333;
|
||||
padding: 15px 28px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 12px 12px 0 0;
|
||||
}
|
||||
a {
|
||||
color: #6c6159;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1><?php echo htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?></h1>
|
||||
<div class="block_exception">
|
||||
<h2><?php echo htmlspecialchars($subTitle, ENT_QUOTES, 'UTF-8'); ?></h2>
|
||||
</div>
|
||||
<div class="block">
|
||||
<?php
|
||||
$escapedMessage = nl2br(htmlspecialchars($message, ENT_QUOTES, 'UTF-8'));
|
||||
$escapedMessage = preg_replace_callback(
|
||||
'#(https?://[^\s]+)#',
|
||||
function ($matches) {
|
||||
$url = htmlspecialchars($matches[0], ENT_QUOTES, 'UTF-8');
|
||||
return "<a href=\"$url\" target=\"_blank\" rel=\"noopener noreferrer\">$url</a>";
|
||||
},
|
||||
$escapedMessage
|
||||
);
|
||||
echo $escapedMessage;
|
||||
?>
|
||||
<div style="text-align: right;">
|
||||
<hr/>
|
||||
<img src="/images/lurana.logo.png" class="img-responsive" alt="Conxole Admin">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -145,7 +145,7 @@ switch (WS_IN_LOGIN) {
|
||||
}
|
||||
|
||||
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]);
|
||||
setcookie('PM-TabPrimary', uniqid(), $cookieOptions);
|
||||
setcookie('LURANA-TabPrimary', uniqid(), $cookieOptions);
|
||||
|
||||
$oHeadPublisher = headPublisher::getSingleton();
|
||||
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
|
||||
|
||||
@@ -76,14 +76,14 @@ function changeCity()
|
||||
{
|
||||
var country=document.getElementById('form[USR_COUNTRY]');
|
||||
var city=document.getElementById('form[USR_CITY]');
|
||||
ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','changeCity','row='+rowNumber+'&country='+encodeURIComponent(country.value)+'&city='+encodeURIComponent(city.value));
|
||||
ajax_function('<?php echo 'cityAjax.php'?>','changeCity','row='+rowNumber+'&country='+encodeURIComponent(country.value)+'&city='+encodeURIComponent(city.value));
|
||||
}
|
||||
function addLocation()
|
||||
{
|
||||
var lr = document.getElementById('lastRow');
|
||||
var city=document.getElementById('form[USR_CITY]');
|
||||
if (newLocation.value=='') return;
|
||||
lr.outerHTML=ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','newLocation','row='+rowNumber+'&location='+encodeURIComponent(newLocation.value)+'&city='+encodeURIComponent(city.value));
|
||||
lr.outerHTML=ajax_function('<?php echo 'cityAjax.php'?>','newLocation','row='+rowNumber+'&location='+encodeURIComponent(newLocation.value)+'&city='+encodeURIComponent(city.value));
|
||||
rowNumber++;
|
||||
newLocation.value='';
|
||||
}
|
||||
@@ -91,7 +91,7 @@ function deleteLocation(locat)
|
||||
{
|
||||
var lr = document.getElementById('DIV_LOCATIONS');
|
||||
var city=document.getElementById('form[USR_CITY]');
|
||||
lr.innerHTML=ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','delLocation','row='+rowNumber+'&uid='+encodeURIComponent(locat)+'&city='+encodeURIComponent(city.value));
|
||||
lr.innerHTML=ajax_function('<?php echo 'cityAjax.php'?>','delLocation','row='+rowNumber+'&uid='+encodeURIComponent(locat)+'&city='+encodeURIComponent(city.value));
|
||||
rowNumber--;
|
||||
}
|
||||
function changeRegion()
|
||||
@@ -104,23 +104,23 @@ function changeRegion()
|
||||
{
|
||||
var city=document.getElementById('form[USR_CITY]');
|
||||
var lr = document.getElementById('DIV_LOCATIONS');
|
||||
lr.innerHTML=ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','changeRegion','city='+encodeURIComponent(city.value));
|
||||
rowNumber=ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','getRowRegion','city='+encodeURIComponent(city.value));
|
||||
lr.innerHTML=ajax_function('<?php echo 'cityAjax.php'?>','changeRegion','city='+encodeURIComponent(city.value));
|
||||
rowNumber=ajax_function('<?php echo 'cityAjax.php'?>','getRowRegion','city='+encodeURIComponent(city.value));
|
||||
}
|
||||
}
|
||||
function changeCities()
|
||||
{
|
||||
var country=document.getElementById('form[USR_COUNTRY]');
|
||||
var lr = document.getElementById('DIV_LOCATIONS');
|
||||
lr.innerHTML=ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','changecities','country='+encodeURIComponent(country.value));
|
||||
rowNumber=ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','getRowCities','country='+encodeURIComponent(country.value));
|
||||
lr.innerHTML=ajax_function('<?php echo 'cityAjax.php'?>','changecities','country='+encodeURIComponent(country.value));
|
||||
rowNumber=ajax_function('<?php echo 'cityAjax.php'?>','getRowCities','country='+encodeURIComponent(country.value));
|
||||
}
|
||||
function addCity()
|
||||
{
|
||||
var lr = document.getElementById('lastRow');
|
||||
var country=document.getElementById('form[USR_COUNTRY]');
|
||||
if (newCity.value=='') return;
|
||||
lr.outerHTML=ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','addCity','row='+rowNumber+'&city='+encodeURIComponent(newCity.value)+'&country='+encodeURIComponent(country.value));
|
||||
lr.outerHTML=ajax_function('<?php echo 'cityAjax.php'?>','addCity','row='+rowNumber+'&city='+encodeURIComponent(newCity.value)+'&country='+encodeURIComponent(country.value));
|
||||
rowNumber++;
|
||||
newCity.value='';
|
||||
//Refresh the city's dropdown
|
||||
@@ -134,7 +134,7 @@ function deleteCity(locat)
|
||||
{
|
||||
var lr = document.getElementById('DIV_LOCATIONS');
|
||||
var country=document.getElementById('form[USR_COUNTRY]');
|
||||
lr.innerHTML=ajax_function('<?php echo G::encryptLink('cityAjax.php')?>','delCity','row='+rowNumber+'&uid='+encodeURIComponent(locat)+'&country='+encodeURIComponent(country.value));
|
||||
lr.innerHTML=ajax_function('<?php echo 'cityAjax.php'?>','delCity','row='+rowNumber+'&uid='+encodeURIComponent(locat)+'&country='+encodeURIComponent(country.value));
|
||||
rowNumber--;
|
||||
//Refresh the city's dropdown
|
||||
attachFunctionEventOnChange(document.getElementById('form[USR_CITY]'),null);
|
||||
|
||||
Reference in New Issue
Block a user