USER_HISTORY-236 Fix the session block funcionality
This commit is contained in:
@@ -202,11 +202,11 @@ class PropelTable
|
||||
$this->filter = urldecode($_GET['filter']);
|
||||
}
|
||||
if ($xmlForm->ajaxServer != '') {
|
||||
$this->ajaxServer = G::encryptLink($xmlForm->ajaxServer);
|
||||
$this->ajaxServer = $xmlForm->ajaxServer;
|
||||
} else {
|
||||
$this->ajaxServer = G::encryptLink('../gulliver/propelTableAjax');
|
||||
$this->ajaxServer = '../gulliver/propelTableAjax';
|
||||
}
|
||||
$this->ownerPage = G::encryptLink(SYS_CURRENT_URI);
|
||||
$this->ownerPage = SYS_CURRENT_URI;
|
||||
// Config attributes from XMLFORM file
|
||||
$myAttributes = get_class_vars(get_class($this));
|
||||
foreach ($this->xmlForm->xmlform->tree->attribute as $atrib => $value) {
|
||||
|
||||
@@ -8,7 +8,7 @@ PM.Sessions = (function () {
|
||||
window.location.pathname.indexOf("sysLogin") === -1 &&
|
||||
window.location.pathname.indexOf("authentication") === -1 &&
|
||||
window.location.pathname.indexOf("/sys/") === -1 &&
|
||||
this.getCookie('PM-TabPrimary') !== '101010010') {
|
||||
this.getCookie('LURANA-TabPrimary') !== '101010010') {
|
||||
this.isClose = (this.getLabel('mainWindowClose') === "true");
|
||||
if (this.isClose && parent.parent.parent.window.name === "") {
|
||||
this.register();
|
||||
@@ -19,30 +19,30 @@ PM.Sessions = (function () {
|
||||
|
||||
Sessions.prototype.register = function () {
|
||||
this.setLabel('mainWindowClose', false);
|
||||
window.name = this.getCookie('PM-TabPrimary');
|
||||
window.name = this.getCookie('LURANA-TabPrimary');
|
||||
};
|
||||
|
||||
Sessions.prototype.checkTab = function () {
|
||||
var ieVersion,
|
||||
msg,
|
||||
win;
|
||||
if (window.name === this.getCookie('PM-TabPrimary')) {
|
||||
if (window.name === this.getCookie('LURANA-TabPrimary')) {
|
||||
this.setLabel('mainWindowClose', false);
|
||||
}
|
||||
if (parent.parent.parent.window.name !== this.getCookie('PM-TabPrimary') &&
|
||||
parent.parent.parent.window.name.indexOf(this.getCookie('PM-TabPrimary')) === -1 ) {
|
||||
if (parent.parent.parent.window.name !== this.getCookie('LURANA-TabPrimary') &&
|
||||
parent.parent.parent.window.name.indexOf(this.getCookie('LURANA-TabPrimary')) === -1 ) {
|
||||
ieVersion = this.detectBrowser();
|
||||
msg = this.getLabel('ID_BLOCKER_MSG');
|
||||
win = window.open('', '_self', '');
|
||||
if (ieVersion && ieVersion <= 11) {
|
||||
win.document.execCommand('Stop');
|
||||
win.open("/errors/block.php","_self");
|
||||
win.open("../login/sessionBlock.php","_self");
|
||||
} else if (ieVersion && ieVersion <= 13) {
|
||||
win.document.execCommand('Stop');
|
||||
win.open("/errors/block.php","_self");
|
||||
win.open("../login/sessionBlock.php","_self");
|
||||
} else {
|
||||
win.stop();
|
||||
win.open("/errors/block.php","_self");
|
||||
win.open("../login/sessionBlock.php","_self");
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -133,7 +133,7 @@ PM.Sessions = (function () {
|
||||
})();
|
||||
|
||||
PM.Sessions.addEventHandler(window, "unload",function () {
|
||||
if (window.name === PM.Sessions.getCookie('PM-TabPrimary')){
|
||||
if (window.name === PM.Sessions.getCookie('LURANA-TabPrimary')){
|
||||
PM.Sessions.setLabel('mainWindowClose', true);
|
||||
}
|
||||
});
|
||||
@@ -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);
|
||||
|
||||
@@ -144,7 +144,7 @@ function openCase(){
|
||||
if(casesNewTab) {
|
||||
casesNewTab.close();
|
||||
}
|
||||
nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_openCase';
|
||||
nameTab = PM.Sessions.getCookie('LURANA-TabPrimary') + '_openCase';
|
||||
casesNewTab = window.open(requestFile + '?' + params, nameTab);
|
||||
} else {
|
||||
redirect(requestFile + '?' + params);
|
||||
|
||||
@@ -243,7 +243,7 @@ function openCase() {
|
||||
}
|
||||
|
||||
newCaseNewTab = window.open(requestFile + '?' + params);
|
||||
newCaseNewTab.name = PM.Sessions.getCookie('PM-TabPrimary');
|
||||
newCaseNewTab.name = PM.Sessions.getCookie('LURANA-TabPrimary');
|
||||
} else {
|
||||
redirect(requestFile + '?' + params);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ function jumpToCase(appNumber) {
|
||||
if (newCaseNewTab) {
|
||||
newCaseNewTab.close();
|
||||
}
|
||||
nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_openCase';
|
||||
nameTab = PM.Sessions.getCookie('LURANA-TabPrimary') + '_openCase';
|
||||
newCaseNewTab = window.open(requestFile + '?' + params, nameTab);
|
||||
} else {
|
||||
redirect(requestFile + '?' + params);
|
||||
|
||||
@@ -459,7 +459,7 @@ function openCaseA(n){
|
||||
if(newCaseNewTab) {
|
||||
newCaseNewTab.close();
|
||||
}
|
||||
nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_openCase';
|
||||
nameTab = PM.Sessions.getCookie('LURANA-TabPrimary') + '_openCase';
|
||||
newCaseNewTab = window.open(res.openCase.PAGE, nameTab);
|
||||
} else {
|
||||
window.location = res.openCase.PAGE;
|
||||
|
||||
@@ -2390,7 +2390,7 @@ function openWindowIfIE(pathDesigner) {
|
||||
if (Ext.getCmp('exportProcessObjectsWindow'))
|
||||
Ext.getCmp('exportProcessObjectsWindow').close();
|
||||
processesGrid.store.reload();
|
||||
nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_winDesigner';
|
||||
nameTab = PM.Sessions.getCookie('LURANA-TabPrimary') + '_winDesigner';
|
||||
if (winDesigner && winDesigner.closed === false) {
|
||||
if (winDesigner.window.PMDesigner.project.isDirty()) {
|
||||
Ext.Msg.alert(_('ID_REFRESH_LABEL'), _('ID_UNSAVED_TRIGGERS_WINDOW'));
|
||||
|
||||
@@ -30,7 +30,7 @@ SELECT LANG_ID, LANG_NAME FROM langOptions
|
||||
|
||||
//validate iframe login
|
||||
if(inIframe() && (window.location.search.indexOf("inIFrame=1")===-1)) {
|
||||
if (PM.Sessions.getCookie('PM-TabPrimary') !== '101010010'
|
||||
if (PM.Sessions.getCookie('LURANA-TabPrimary') !== '101010010'
|
||||
&& (window.location.pathname.indexOf("login/login") !== -1
|
||||
|| window.location.pathname.indexOf("sysLogin") !== -1)) {
|
||||
window.top.location.href = window.location.pathname;
|
||||
|
||||
Reference in New Issue
Block a user