protected function Login() { //If user is logged in redirect to dashboard if (parent::IsLoggedIn()) { parent::Redirect('dashboard'); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { //POST $model = new AccountModel("Login", true); //Error checking if ($model->hasError()) { $model->setPageTitle('Login'); $this->ReturnViewByName("login", $model->view, "login_layout"); exit; } $this->Redirect('dashboard'); } else { //GET $model = new AccountModel("Login"); $model->setPageTitle('Login'); $this->ReturnViewByName("login", $model->view, "login_layout"); } }
protected function Complete() { $params = array('id' => $_POST['id'], 'email' => $_POST['email'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'password' => $_POST['password'], 'confirm_password' => $_POST['confirm_password']); $model = new AccountModel("Complete", true, $params); //Error checking if ($model->hasError()) { //Model has errors, add params to model to repopulate form $model->view->id = $params['id']; $model->view->email = isset($params['email']) ? $params['email'] : null; $model->view->first_name = isset($params['first_name']) ? $params['first_name'] : null; $model->view->last_name = isset($params['last_name']) ? $params['last_name'] : null; $model->setPageTitle("Account Verified"); $this->ReturnViewByName('verify', $model->view, 'layout'); exit; } $model->setPageTitle("Complete Registration"); $model->setMesssage(MessageType::Success, 'Account Set Up Complete', 'Signed in as, ' . $_POST['email'] . '!'); //Login $_SESSION['Username'] = $_POST['email']; $_SESSION['LoggedIn'] = 1; //ACCOUNT COMPLETION: Redirect to /APP/Invest/Index $this->Redirect('app', 'dashboard'); }
protected function ResetPassword($v = '', $e = '') { if ($_SERVER['REQUEST_METHOD'] === 'POST') { //POST $model = new AccountModel("ResetPassword", true); //Error checking if ($model->hasError()) { //Model has errors, add params to model to repopulate form $model->view->id = $_POST['id']; $model->view->email = $_POST['email']; $model->setPageTitle("Password Reset"); $this->ReturnViewByName('resetpassword', $model->view); exit; } $this->ReturnViewByName('login', $model->view); } else { //GET $model = new AccountModel("ResetPassword", false, $this->urlParams); $model->setPageTitle("Reset Password"); $this->ReturnView($model->view); } }