function recoverPassword()
 {
     $nore = $this->trimmed('nicknameoremail');
     if (!$nore) {
         // TRANS: Form instructions for password recovery form.
         $this->showForm(_('Enter a nickname or email address.'));
         return;
     }
     try {
         User::recoverPassword($nore);
         $this->mode = 'sent';
         if (common_is_email($nore) && common_config('site', 'fakeaddressrecovery')) {
             // TRANS: User notification when recovering password by giving email address,
             //        regardless if the mail was sent or not (to hide registered email status).
             $this->msg = _('If the email address you provided was found in the database, a recovery mail with instructions has been sent there.');
         } else {
             // TRANS: User notification after an e-mail with instructions was sent from the password recovery form.
             $this->msg = _('Instructions for recovering your password ' . 'have been sent to the email address registered to your ' . 'account.');
         }
         $this->success = true;
     } catch (Exception $e) {
         $this->success = false;
         $this->msg = $e->getMessage();
     }
     $this->showPage();
 }
 function recoverPassword()
 {
     $nore = $this->trimmed('nicknameoremail');
     if (!$nore) {
         // TRANS: Form instructions for password recovery form.
         $this->showForm(_('Enter a nickname or email address.'));
         return;
     }
     try {
         User::recoverPassword($nore);
         $this->mode = 'sent';
         // TRANS: User notification after an e-mail with instructions was sent from the password recovery form.
         $this->msg = _('Instructions for recovering your password ' . 'have been sent to the email address registered to your ' . 'account.');
         $this->success = true;
         $this->showPage();
     } catch (Exception $e) {
         $this->success = false;
     }
 }
Example #3
0
ob_start();
require __DIR__ . '/../app/init.php';
// if there is an active log in process redirect to students.class.php; load page only if no
// logged in user exists
$general->loggedInProtect();
$pageTitle = "Log In";
if (isUpdatePasswordBtnPressed()) {
    try {
        if (!isUrlOriginal()) {
            throw new Exception("It seems you've modified the email url we send you. Please click the original link to proceed.");
        }
        $newPassword1 = trim($_POST['new-password-1']);
        $newPassword2 = trim($_POST['new-password-2']);
        $id = $_GET['id'];
        $genString = $_GET['gen_string'];
        User::recoverPassword($id, $newPassword1, $newPassword2, $genString);
        header('Location: ' . BASE_URL . 'login/recover/success');
        exit;
    } catch (Exception $e) {
        $errors[] = $e->getMessage();
    }
}
function isUpdatePasswordBtnPressed()
{
    return isset($_POST['form_action_update_password']) && empty($_POST['form_action_update_password']);
}
/**
 * @return bool
 */
function isVerified()
{