Validate if logen user is not guest.
Close previous session if webentry is anonymous.
This commit is contained in:
davidcallizaya
2017-12-11 11:17:10 -04:00
parent 2dc1b9408f
commit 1421873bad
2 changed files with 3 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ try {
throw new Exception('WebEntry User not found'); throw new Exception('WebEntry User not found');
} }
$_SESSION = [];
initUserSession($userUid, $userInfo->getUsrUsername()); initUserSession($userUid, $userInfo->getUsrUsername());
$result = [ $result = [

View File

@@ -187,6 +187,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
var weUid = <?php echo G::json_encode($webEntryModel->getWeUid()); ?>; var weUid = <?php echo G::json_encode($webEntryModel->getWeUid()); ?>;
var forceLogin = <?php echo G::json_encode($webEntryModel->getWeAuthentication()==='LOGIN_REQUIRED'); ?>; var forceLogin = <?php echo G::json_encode($webEntryModel->getWeAuthentication()==='LOGIN_REQUIRED'); ?>;
var isLogged = <?php echo G::json_encode(!empty($_SESSION['USER_LOGGED'])); ?>; var isLogged = <?php echo G::json_encode(!empty($_SESSION['USER_LOGGED'])); ?>;
var currentLoggedIsGuest = <?php echo G::json_encode(!empty($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] === RBAC::GUEST_USER_UID); ?>;
var closeSession = <?php echo G::json_encode($webEntryModel->getWeCallback()==='CUSTOM_CLEAR'); ?>; var closeSession = <?php echo G::json_encode($webEntryModel->getWeCallback()==='CUSTOM_CLEAR'); ?>;
var hideInformationBar = <?php echo G::json_encode(!!$webEntryModel->getWeHideInformationBar()); ?>; var hideInformationBar = <?php echo G::json_encode(!!$webEntryModel->getWeHideInformationBar()); ?>;
if (!forceLogin) { if (!forceLogin) {
@@ -263,7 +264,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
}; };
var login = function () { var login = function () {
return new Promise(function (logged, failure) { return new Promise(function (logged, failure) {
if (!isLogged) { if (!isLogged || currentLoggedIsGuest) {
log("login"); log("login");
open('../login/login?inIFrame=1&u=' + encodeURIComponent(location.pathname + '/../../webentry/logged')) open('../login/login?inIFrame=1&u=' + encodeURIComponent(location.pathname + '/../../webentry/logged'))
.then(function (userInformation) { .then(function (userInformation) {