public function verifyData() { $FU = new FUser(); $res = "-1"; //suppongo campi vuoti $VLog = new VLog(); if ($VLog->getMail() && $VLog->getPassword()) { $_mail = $VLog->getMail(); $_password = $VLog->getPassword(); try { $user = $FU->loadUser($_mail); if ($user) { if ($_mail == $user->getMail() && $_password == $user->getPassword() && $user->getStatus()) { $res = "0"; //l'utente esiste ed è verificato } else { if (!$user->getStatus()) { $res = "1"; } else { $res = "2"; } //password errata } } else { $res = "3"; } //Non esiste l'utente } catch (Exception $e) { $res = "5"; } } else { $res = "4"; } echo $res; }
public function change_password() { $VUser = new VUser(); $passwords = $VUser->getChangePasswords(); $data = 1; if ($passwords) { $FUser = new FUser(); $session = new USession(); try { $user = $FUser->loadUser($session->getValue('mail')); if ($user && $passwords['password'] == $passwords['r_password'] && $user->getPassword() == $passwords['old_password']) { $data = 0; $user->setPassword($passwords['password']); $FUser->saveUser($user); $session->setValue("password", $passwords['password']); } else { if (!$user) { //Non c'è l'utente (IMPOSSIBILE) $data = 2; } else { if ($user->getPassword() != $passwords['old_password']) { //la vecchia password è errata $data = 3; } else { $data = 4; } } //le password ripetute non coincidono } } catch (Exception $e) { $data = 1; //la password è nel formato sbagliato } } return $this->show("reset_outcome", $data); }
public function dataManagement() { global $config; $FUser = new FUser(); $FRent = new FRent(); $siteName = $config['name']; $max = $config['max']; $clientList = $FUser->loadUsersAndClients(); $gain = $FRent->getGain(); $egain = $FRent->getEstimatedGain(); $ngain = $FRent->getUnpaidGain(); $VAdmin = new VAdmin(); if ($config['season_end'] == "closed" && $config['season_start'] == "closed") { $season_data = ""; $seasonStart = "Chiusa"; $seasonEnd = "Chiusa"; } else { $season_data = $VAdmin->fetch("close_season_mod.tpl"); $seasonStart = $config['season_start']; $seasonEnd = $config['season_end']; } $VAdmin->setData('max', $max); $VAdmin->setData('ngain', $ngain); $VAdmin->setData('egain', $egain); $VAdmin->setData('gain', $gain); $VAdmin->setData('siteName', $siteName); $VAdmin->setData('sdate', $seasonStart); $VAdmin->setData('edate', $seasonEnd); $VAdmin->setData('season_mod', $season_data); $VAdmin->setData('client_list', $clientList); return $VAdmin->fetch('data_manage.tpl'); }
public function login() { $FU = new FUser(); $bool = false; $VLog = new VLog(); if ($VLog->getMail() && $VLog->getPassword()) { $_mail = $VLog->getMail(); $_password = $VLog->getPassword(); $user = $FU->loadUser($_mail); if ($user) { if ($_mail == $user->getMail() && $_password == $user->getPassword() && $user->getStatus()) { $session = new USession(); $_name = $user->getName(); $_surname = $user->getSurname(); $_ssn = $user->getSSN(); $_status = $user->getStatus(); $_type = $user->getType(); $session->setValue('name', $_name); $session->setValue('surname', $_surname); $session->setValue('ssn', $_ssn); $session->setValue('type', $_type); $session->setValue('mail', $_mail); $bool = true; //l'utente Ú loggato } } } return $bool; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = FUser::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionResendActivation() { $userId = $this->get('Id', 0); $user = NULL; if ($userId > 0) { $user = FUser::model()->findByPk($userId); if (!is_null($user)) { $result = app()->XService->run('User/Account/resendActivation', array('user' => $user, 'rawPassword' => NULL)); } } $this->render('ResendActivation', array('result' => $result)); }
public function loadUserByFBID($facebookID) { $fu = FUser::model()->find('facebookID=:facebookID', array(':facebookID' => $facebookID)); if (isset($fu)) { return $fu; } return null; }