diff options
author | M.Gergo | 2019-01-20 11:48:48 +0100 |
---|---|---|
committer | M.Gergo | 2019-01-20 11:48:48 +0100 |
commit | f70027ffbedce10f412868a7bf9b0b67b113f1b1 (patch) | |
tree | fbcc48049f1e66fe3ec66a0f3d8eee47bb400cdb /mayor-orig/www/include/base/login.php | |
parent | e6988247360fa98b85915a38803d018dd353df00 (diff) | |
download | mayor-f70027ffbedce10f412868a7bf9b0b67b113f1b1.tar.gz mayor-f70027ffbedce10f412868a7bf9b0b67b113f1b1.zip |
Rev: 4423
Diffstat (limited to 'mayor-orig/www/include/base/login.php')
-rw-r--r-- | mayor-orig/www/include/base/login.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/mayor-orig/www/include/base/login.php b/mayor-orig/www/include/base/login.php index da3217a9..4624a92a 100644 --- a/mayor-orig/www/include/base/login.php +++ b/mayor-orig/www/include/base/login.php @@ -1,6 +1,6 @@ <?php - if ($action == 'mayorGlobalLogin' || $action == 'facebooklogin' || $action== 'googleapilogin') { + if ($sessionMode===2 || $action == 'mayorGlobalLogin' || $action == 'facebooklogin' || $action== 'googleapilogin') { $toPolicy = readVariable($_REQUEST['toPolicy'], 'enum', 'private', $POLICIES); $policyOrderIndex = readVariable($_POST['policyOrderIndex'], 'id', 0); @@ -46,6 +46,15 @@ $userAccount = $GOOGLEAPIDATA['userAccount']; $googleapiAuth = true; } + } elseif ($sessionMode===2) { + $MAYORAPIDATA = mayorApiAuth(); + if ($MAYORAPIDATA!==false && $MAYORAPIDATA['userAccount']!="") { + $userAccount = $MAYORAPIDATA['userAccount']; + $toPolicy = $MAYORAPIDATA['toPolicy']; + $mayorapiAuth = true; + } else { + unsetTokenCookies(); // + unregister token + } } else { $userPassword = readVariable($_POST['userPassword'], 'string'); // $userAccount = readVariable($_POST['userAccount'], 'regexp', null, array("^([a-z]|[A-Z]|[0-9]| |\.|,|_|[űáéúőóüöíŰÁÉÚŐÓÜÖÍäÄ]|-|@)*$")); @@ -56,7 +65,7 @@ if (is_array($AUTH[$toPolicy]['allowOnly']) && !in_array($userAccount,$AUTH[$toPolicy]['allowOnly'])) $userAccount=''; if ($sessionID != '') $accountInformation['sessionID'] = $sessionID; - if ($userAccount != '' and ($userPassword != '' or $fbAuth===true or $googleapiAuth===true)) { + if ($userAccount != '' and ($userPassword != '' or $fbAuth===true or $googleapiAuth===true or $mayorapiAuth === true)) { for ($i=0; $i<count($__POLICYORDER[$policyOrderIndex]); $i++) { $toPolicy=$__POLICYORDER[$policyOrderIndex][$i]; @@ -84,6 +93,15 @@ $_SESSION['alert'][] = 'info:A google azonosító nincs még összekötve! Először lépj be a MaYoR-ba, és kezdeményezd!'; continue;; } + } elseif ($mayorapiAuth===true) { + if ($MAYORAPIDATA['toPolicy'] == $toPolicy) { + $result = _AUTH_SUCCESS; // az authentikációt a mayorApiAuth() csinálta + $accountInformation['cn'] = $MAYORAPIDATA['userCn']; + // $accountInformation['mail'] = $MAYORAPIDATA['userEmail']; + $accountInformation['studyId'] = $MAYORAPIDATA['studyId']; + } else { + continue;; + } } else { $result = userAuthentication($userAccount, $userPassword, $accountInformation, $toPolicy); // ??? toPolicy benne van az AccountInformation-ben!!! Ldap backend only? } @@ -93,6 +111,7 @@ if ($result === _AUTH_SUCCESS) { $_SESSION['alert'] = array(); $sessionID = newSession($accountInformation, $toPolicy); + if ($mayorapiAuth!==true) generateAuthToken(array('userAccount'=>$userAccount, 'policy'=>$toPolicy, 'userCn'=>$accountInformation['cn'], 'studyId'=>$accountInformation['studyId'])); // --TODO untrusted clients if ($toSkin == '') $toSkin = $skin; header('Location: '.location("index.php?page=$toPage&sub=$toSub&f=$toF&sessionID=$sessionID&policy=$toPolicy&lang=$lang&skin=$toSkin", array('alertOLD'))); break; |