Exemple #1
0
 function forgot()
 {
     $userId = Users::getUserIdByName($_POST["txtUserNameForgot"]);
     if ($userId != -1) {
         $code = self::generateCode(16);
         Users::addCode($userId, $code);
         $headers = 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
         $subject = "Réinitialisation de votre mot de passe";
         $data = array('passwordResetLink' => SERVER_ABSOLUTE_PATH . "/passwordreset", 'code' => $code, 'img' => PUBLIC_ABSOLUTE_PATH . "/assets/favicons/android-icon-192x192.png");
         $mustache = new Mustache_Engine();
         mail($_POST["txtUserNameForgot"], $subject, $mustache->render(file_get_contents('public/html/mailtemplate.html'), $data), $headers . "From: " . SENDING_EMAIL);
     }
     $data = array("Forgot" => true);
     $this->renderTemplate(file_get_contents(CONNECTION_PAGE), $data);
 }