diff options
Diffstat (limited to 'mayor-orig/www/include/base/login.php')
-rw-r--r-- | mayor-orig/www/include/base/login.php | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/mayor-orig/www/include/base/login.php b/mayor-orig/www/include/base/login.php deleted file mode 100644 index 4624a92a..00000000 --- a/mayor-orig/www/include/base/login.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php - - if ($sessionMode===2 || $action == 'mayorGlobalLogin' || $action == 'facebooklogin' || $action== 'googleapilogin') { - - $toPolicy = readVariable($_REQUEST['toPolicy'], 'enum', 'private', $POLICIES); - $policyOrderIndex = readVariable($_POST['policyOrderIndex'], 'id', 0); - - $__POLICYORDER[0] = array('private','parent','public'); - $__POLICYORDER[1] = array('private'); - $__POLICYORDER[2] = array('parent'); - $__POLICYORDER[3] = array('public'); - - $toSkin = readVariable($_POST['toSkin'], 'enum', readVariable($_GET['toSkin'], 'enum', null, $SKINSSHOW), $SKINSSHOW); - @list($toPage,$toSub,$toF) = readVariable(explode(':',$_REQUEST['toPSF']), 'strictstring'); - $toPSF = "$toPage:$toSub:$toF"; - // Autentikáció - alapok - $fbAuth = false; - if (file_exists('include/share/auth/base.php')) { - require_once('include/share/auth/base.php'); - } - require_once('include/modules/auth/base/login.php'); - - // lejart session-ok torlese - require_once('include/share/session/close.php'); - closeOldAndIdleSessions(); - - if (__FBCONNECT_ENABLED===true && $action=='facebooklogin') { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $_SESSION['alert'][] = 'info::facebook:szerver konfigurációs hiba, legalább 5.4-es php verzió szükséges'; - return false; - } - require_once('include/share/net/facebook.php'); - $FBDATA = mayorFacebookAuth(); // preAuth - if (is_array($FBDATA) && $FBDATA['accessToken']!="") { - $userAccount = $FBDATA['userAccount']; - $fbAuth = true; - } - } elseif (__GOOGLEAPI_ENABLED===true && $action=='googleapilogin') { - if (version_compare(PHP_VERSION, '5.5.0', '<')) { - $_SESSION['alert'][] = 'info::googleapi:szerver konfigurációs hiba, legalább 5.5-ös php verzió szükséges'; - return false; - } - require_once('include/share/net/googleapi.php'); - $GOOGLEAPIDATA = mayorGoogleApiAuth(); // preAuth - if (($GOOGLEAPIDATA) && $GOOGLEAPIDATA['userAccount']!="") { - $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]| |\.|,|_|[űáéúőóüöíŰÁÉÚŐÓÜÖÍäÄ]|-|@)*$")); - $userAccount = readVariable($_POST['userAccount'], 'userAccount', null); - } - - if (defined('_BOLONDOS') && _BOLONDOS===true) $userAccount = visszafele($userAccount); - 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 or $mayorapiAuth === true)) { - - for ($i=0; $i<count($__POLICYORDER[$policyOrderIndex]); $i++) { - $toPolicy=$__POLICYORDER[$policyOrderIndex][$i]; - if (!in_array($AUTH[$toPolicy]['authentication'],array('required','try'))) { - continue;; - } - $accountInformation = array('account' => $userAccount, 'password' => $userPassword, 'policy' => $toPolicy, 'skin'=>$toSkin); - if ($fbAuth===true) { - if ($FBDATA['toPolicy']==$toPolicy) { - $result = _AUTH_SUCCESS; // az authentikációt a mayorFacebookAuth() csinálta - $accountInformation['cn'] = $FBDATA['fbUserCn']; - $accountInformation['mail'] = $FBDATA['fbUserEmail']; - $accountInformation['studyId'] = $FBDATA['studyId']; - } else { - $_SESSION['alert'][] = 'info:A facebook azonosító nincs még összekötve! Először lépj be a MaYoR-ba, és kezdeményezd a facebook connectet!'; - continue;; - } - } elseif ($googleapiAuth===true) { - if ($GOOGLEAPIDATA['toPolicy']==$toPolicy) { - $result = _AUTH_SUCCESS; // az authentikációt a mayorGoogleapiAuth() csinálta - $accountInformation['cn'] = $GOOGLEAPIDATA['googleUserCn']; - $accountInformation['mail'] = $GOOGLEAPIDATA['googleUserEmail']; - $accountInformation['studyId'] = $GOOGLEAPIDATA['studyId']; - } else { - $_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? - } - logLogin($toPolicy, $userAccount, $result); - - define('_MAYORAUTHRESULT',$result); - 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; - } elseif ($result === _AUTH_EXPIRED) { - $_SESSION['alert'][] = 'message:force_pw_update'; - header('Location: '.location("index.php?policy=public&page=password&f=changeMyPassword&userAccount=".$userAccount."&toPolicy=$toPolicy&skin=$toSkin", array('alertOLD'))); - break; - } elseif ($result === _AUTH_FAILURE_1) { - // nincs ilyen user, megpróbáljuk beauthentikálni parent-tel is. - } elseif ($result >= _AUTH_FAILURE) { - // sikertelen azonosítás - a hibaüzenetet a függvény generálja - // megpróbáljuk beauthentikálni parent-tel is. - break; - } else { - // Ilyen csak hibás függvényműködés esetén lehet: - $_SESSION['alert'][] = "message:default:hibás visszatérési érték:userAuthentication:(".serialize($result).")"; - break; - } - } - } else { - $_SESSION['alert'][] = 'message:empty_field'; - } - } - -?> |