Reset Password
Forget your password? Don't worry, you can reset it. Enter your username and reminder question information below.
Please correct the following:
=$oTpl->_($sErr)?>'Username', 'password' => 'Password', 'password_confirm' => 'Re-enter Password', 'secret_id' => 'Pick a reminder question', 'secret_answer' => 'Your answer' ); require_once('/afs/ece.cmu.edu/web/ece/htdocs/tools/msc-game/encryption-keys.php'); $oLogin = new Login_Cyberacademy(); $bIsLoggedIn = $oLogin->isLoggedIn(); // Get the secret questions $sSql = 'SELECT secret_id, secret_name FROM gm_lkp_user_secret'; $aSecretQuestions = DBConn::getArray($sSql, 'secret_id', 'secret_name'); $oErr = new ErrorCollector(); if (!empty($_POST['submit'])) { // Scrub input foreach ($_POST as $sKey => $sVal) { $_POST[$sKey] = getPost($sKey); } // Validate input // Check for missing inputs foreach ($aRequiredFields as $sRequiredField => $sRequiredFieldDescription) { if (empty($_POST[$sRequiredField])) { $oErr->add('"' . $sRequiredFieldDescription . '" must be provided.', true); } } // Verify the incoming information $sSql = 'SELECT user_id FROM gm_user WHERE user_username = ? AND secret_id = ! AND secret_answer = AES_ENCRYPT(?, ?)'; $iUserId = DBConn::getValue($sSql, 'user_id', array($_POST['username'], $_POST['secret_id'], $_POST['secret_answer'], AES_ENCRYPTION_KEY_SECRET)); if (empty($iUserId)) { $oErr->add('We are unable to retrieve your account information. Please be sure that you have provided the correct username and secret question and answer.', true); } else if ($_POST['password'] != $_POST['password_confirm']) { $oErr->add('The passwords provided do not match.', true); } else if (!empty($_POST['password']) && strlen($_POST['password']) < $iMinPasswordLength) { $oErr->add('The password provided was too short. Please use a password with at least ' . $iMinPasswordLength . ' characters.'); } else if (strpos($_POST['password'], ' ') !== false) { $oErr->add('Your password can not contain any spaces.', true); } if (!$oErr->hasError()) { // Update the password $sSql = 'UPDATE gm_user SET user_password = AES_ENCRYPT(?, ?) WHERE user_id = !'; if (DBConn::executeNonQuery($sSql, array($_POST['password'], AES_ENCRYPTION_KEY_PASSWORD, $iUserId))) { doRedirect('passwordComplete.html'); } else { $oErr->add('We were unable to update your information. Please try again, or email us for help.', true); } } } $sErr = $oErr->toString(); $oTpl = new Savant2_Common(); ?>