function login() { $username = $_POST['username']; $password = $_POST['password']; unset($_POST['username']); unset($_POST['password']); $login = new LoginManager(); $login->login($username, $password); }
/** * doLogin will try to login the user ***/ function doLogin($username, $password) { $LoginManager = new LoginManager(); $loginresult = $LoginManager->login($username, $password); if (!$loginresult) { loginFailed(); } else { loginOk(); } }
function execute() { require_once 'openid.php'; $openid = new Dope_OpenID($_GET['openid_identity']); $validate_result = $openid->validateWithServer(); if ($validate_result === TRUE) { $userinfo = $openid->filterUserInfo($_GET); LoginManager::login($_GET['openid_identity'], $userinfo['email'], $userinfo['fullname']); } else { if ($openid->isError() === TRUE) { LoginManager::logout(); $error = $openid->GetError(); $this->error = _("Login failed.") . '<br />'; $this->error .= "Error code: " . $error['code'] . "<br/>"; $this->error .= "Error description: " . $error['description'] . "<br/>"; } else { LoginManager::logout(); // Signature Verification Failed $this->error = _("Login failed."); } } /* $openid = new SimpleOpenID; $openid->SetIdentity($_GET['openid_identity']); $openid_validation_result = $openid->ValidateWithServer(); if ($openid_validation_result == true){ // OK HERE KEY IS VALID print_r($openid->fields['required']); LoginManager::login($_GET['openid_identity']); }else if($openid->IsError() == true){ // ON THE WAY, WE GOT SOME ERROR LoginManager::logout(); $error = $openid->GetError(); $this->error = _("Login failed.").'<br />'; $this->error .= "Error code: " . $error['code'] . "<br/>"; $this->error .= "Error description: " . $error['description'] . "<br/>"; }else{ LoginManager::logout();// Signature Verification Failed $this->error = _("Login failed."); } */ }
public function display(Template $oTemplate, $bIsPreview = false) { if (Manager::isPost()) { ArrayUtil::trimStringsInArray($_POST); } //1st step: user clicked on the recovery link // • Display email field if (isset($_REQUEST['password_forgotten'])) { $this->sAction = 'password_forgotten'; } //2nd step: user has entered an email address // • Send the email with the recovery link (and generate the hint) // • Add confirmation message to flash if (isset($_POST['password_reset_user_name'])) { $this->sAction = LoginManager::processPasswordReset(LinkUtil::link($this->oPage->getFullPathArray(), 'FrontendManager')); } //3rd step: user has clicked on the reset link in the e-mail // • Validate the hint // • Display a form for entering a new password (form also contains hidden fields for email and hint) // • Add the referrer to the session (again) if (isset($_REQUEST['recover_username'])) { $this->sAction = LoginManager::passwordReset(); } //4th step: user has submitted the new password // • Validate the hint (again) // • Validate password constraints // • Set the new password (if valid) // • Log in (if valid) // • Redirect to the referrer (if valid) if (isset($_POST['new_password'])) { $this->sAction = LoginManager::loginNewPassword(LinkUtil::link($this->oPage->getFullPathArray())); } if (isset($_POST[LoginManager::USER_NAME])) { LoginManager::login(null, null, LinkUtil::link($this->oPage->getFullPathArray())); } parent::display($oTemplate, $bIsPreview); }
<?php //INCLUIR TODAS LAS CLASES DE LA APLICACIÓN include './LoginManager.php'; include './FotosManager.php'; include './ViajeManager.php'; //EXTRAER TODAS LAS VARIABLES Y PETICIONES DE IOS extract($_REQUEST); //SEGÚN LA PETICIÓN INSTANCIAMOS OBJTOS DE LA CLASE NECESARIA Y LLAMAMOS //A LA FUNCIÓN CORRESPONDIENTE switch ($p) { case "login": $loginManager = new LoginManager(); $loginManager->login($correo, $password); break; case "registro": $loginManager = new LoginManager(); $loginManager->registro($correo, $password); break; case "listarViajes": $viajesManager = new ViajeManager(); $viajesManager->listarViajes($id_usuario); break; case "eliminarViaje": $viajesManager = new ViajeManager(); $viajesManager->eliminarViaje($id_viaje); break; case "editarViaje": $viajesManager = new ViajeManager(); $viajesManager->editarViaje($id_viaje, $titulo, $fecha); break;
<?php header('Content-type: application/json'); $METHOD = $_SERVER['REQUEST_METHOD']; $APIURI = $_SERVER['REQUEST_URI']; if ($METHOD == 'POST') { //decodificamos la información recibida desde el formulario de login $json = file_get_contents('php://input'); $obj = json_decode($json, true); require 'QueryManager.php'; //logueamos al usuario $loginManager = new LoginManager(); $loginManager->login($obj); //según el tipo de usuario logueado, se realizan diferentes operaciones switch ($_SESSION["userType"]) { case 'UgTuNHEQEZ': die("No tenés permisos para utilizar esta aplicación."); break; case 'o8hdPDhJDE': header("Location:Administrador.php"); break; default: $queryManager = new QueryManager(); $queryManager->query(); break; } } else { header('HTTP/1.1 405 Method Not Allowed'); header('Allow: POST'); }
<?php include_once 'LoginManager.php'; if (!isset($_POST['submit'])) { header("Location: ../index.php"); exit; } $source = filter_input(INPUT_POST, 'source'); $loginManager = new LoginManager($source); if (!isset($_POST['email'])) { $loginManager->logout(); header("Location: ../{$source}"); exit; } else { $email = filter_input(INPUT_POST, 'email'); $password = filter_input(INPUT_POST, 'password'); $loginManager->login($email, $password); } if (strpos($source, "?") !== FALSE) { $notificationGets = "&signin=" . $loginManager->getLoggedInUserName(); } else { $notificationGets = "?signin=" . $loginManager->getLoggedInUserName(); } header("Location: ../{$source}{$notificationGets}");