// return $data and $error as json exit; } $userView->details('add', $data); break; case 'forgot-password': // send an emai with the forgotten password $data = array(); $error = array(); if ($_SERVER['REQUEST_METHOD'] === "POST") { $values = array('email' => array('email' => isset($_POST['email']) ? $_POST['email'] : '')); $dotValidateUser = new Dot_Validate_User(array('who' => 'user', 'action' => 'forgot-password', 'values' => $values)); if ($dotValidateUser->isValid()) { // no error - then send password $data = $dotValidateUser->getData(); $userModel->forgotPassword($data['email']); } else { $session->message['txt'] = $dotValidateUser->getError(); $session->message['type'] = 'error'; } } $userView->details('forgot_password', $data); break; case 'reset-password': // start by considering there are no errors, and we enable the form $disabled = false; // not sure if the form was submitted or not yet , either from Request or from POST $userId = array_key_exists('id', $registry->request) ? $registry->request['id'] : (isset($_POST['userId']) ? $_POST['userId'] : ''); $userToken = array_key_exists('token', $registry->request) ? $registry->request['token'] : (isset($_POST['userToken']) ? $_POST['userToken'] : ''); // get user info based on ID , and see if is valid $userInfo = $userModel->getUserInfo($userId);
<?php session_start(); include_once '../admin/include/Connection.class.php'; include_once '../admin/include/User.class.php'; //print_r($_SESSION); $user = new User(); if (isset($_POST['btn-login'])) { $umail = $_POST['txt_uname_email']; if (!filter_var($umail, FILTER_VALIDATE_EMAIL)) { $error[] = 'Please enter a valid email address !'; } else { if ($user->checkEmailExist($umail)) { $error[] = 'Email Address does not Exist! Please Try Again!'; } else { $user->forgotPassword($umail); //$user->redirect('forgotPassword.php?emailed'); } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Forgot Password - Burpbig</title> <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" /> <link rel="stylesheet" href="css/style.css" type="text/css" /> </head> <body> <div class="container">