Ejemplo n.º 1
0
 public static function getInstance()
 {
     if (self::$instance === null)
     {
         self::$instance = new LostPassword();
     }
     return self::$instance;
 }
 public function reset()
 {
     $code = $this->PostData('code');
     if (!$code) {
         $code = $this->GetData('code');
     }
     if ($code) {
         $lost_password = LostPassword::find_by_code($code);
         if ($lost_password) {
             $response = $lost_password->activate();
             if ($response[0]) {
                 Email::send_new_password($lost_password->user, $response[1]);
                 Site::flash("notice", "Your new password has been sent to {$lost_password->user->email}");
                 Redirect("login");
             } else {
                 $this->site['flash']['error'] = "There was an error resetting your password";
             }
         } else {
             $this->site['flash']['error'] = "The code you entered could not be found or is not valid";
         }
     }
     $this->assign("code", $code);
     $this->render("lost_password/reset.tpl");
 }
Ejemplo n.º 3
0
 public function get_lost_passwords($reload = false)
 {
     if ($reload or !$this->lost_passwords_cache) {
         $id = mysql_real_escape_string($this->id);
         $this->lost_passwords_cache = LostPassword::find_all("lost_passwords.used = 0 AND lost_passwords.user = '******' AND lost_passwords.updated_at >= (NOW() - INTERVAL 2 DAY))");
     }
     return $this->lost_passwords_cache;
 }
Ejemplo n.º 4
0
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES . "templates/header.php";
require_once INCLUDES . "sendmail_include.php";
include LOCALE . LOCALESET . "lostpassword.php";
if (iMEMBER) {
    redirect("index.php");
}
function __autoload($class)
{
    require CLASSES . $class . ".class.php";
    if (!class_exists($class)) {
        die("Class not found");
    }
}
add_to_title($locale['global_200'] . $locale['400']);
opentable($locale['400']);
$obj = new LostPassword();
if (isset($_GET['user_email']) && isset($_GET['account'])) {
    $obj->checkPasswordRequest($_GET['user_email'], $_GET['account']);
    $obj->displayOutput();
} elseif (isset($_POST['send_password'])) {
    $obj->sendPasswordRequest($_POST['email']);
    $obj->displayOutput();
} else {
    $obj->renderInputForm();
    $obj->displayOutput();
}
closetable();
require_once THEMES . "templates/footer.php";