public function forgetPasswordAction()
 {
     $translate = $this->application->get('translator');
     if (empty($_POST['login'])) {
         $err_msg = $translate->translate('fields_empty');
     } else {
         $email = $this->application->get('database_connection')->prepareStatement('SELECT email FROM users WHERE login = :login', ['login' => $_POST['login']])->fetch(\PDO::FETCH_ASSOC)['email'];
         if (count($email) === 0) {
             $err_msg = $translate->translate('no_result');
         } else {
             $code_generated = $this->generateCode($_POST['login']);
             $mail = new Mailer();
             $mail->addRecipient($email[0]['email'], '');
             $mail->addFrom('*****@*****.**', '');
             $mail->addSubject('8thwonderland - ' . $translate->translate('forget_pwd'), '');
             $mail->html = $translate->translate('mail_forgetpwd') . $code_generated;
             if (!$mail->envoi()) {
                 $err_msg = $mail->errorLog();
             }
         }
     }
     if (!empty($err_msg)) {
         return new Response('<div class="error" style="padding:3px"><table style="width:70%"><tr>' . '<td><img alt="error" src="' . ICO_PATH . '64x64/Error.png" style="width:24px;"/></td>' . '<td><span style="font-size: 13px;">' . $err_msg . '</span></td>' . '</tr></table></div>');
     }
     return new Response('<form id="form_forgetpwdCode" name="form_forgetpwdCode" enctype="application/x-www-form-urlencoded" action="" method="post" ' . 'onSubmit=\'sendForm("/authenticate/valid_codeforgetpwd", "form_forgetpwdCode", "reponse_forgetpwdcode"); return false;\' >' . '<table><tr><td>' . $translate->translate('code_forgetpwd') . '</td>' . '<td><input type="text" name="code" id="code" style="width:70%" /></td>' . '<tr><td colspan="2" align="center"><input type="submit" name="btn_forgetpwdcode" id="btn_forgetpwdcode" value="' . $translate->translate('btn_codeforgetpwd') . '"></td>' . '</tr>' . '<tr><td><input id="memo_login" name="memo_login" type="hidden" value="' . $_POST['login'] . '"/></td><td id="reponse_forgetpwdcode"></td></tr>' . '</table></form>');
 }
 protected function process()
 {
     $email = $_POST['mail_sender'];
     $res = null;
     $user = null;
     $domain = null;
     $MXHost = null;
     preg_match("/\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*/", $email, $res);
     $translator = $this->application->get('translator');
     if (!$res || $res[0] !== $email || empty($email)) {
         $this->contactStatus = $translator->translate('mail_invalide');
     } else {
         list($user, $domain) = explode('@', $email);
         if (!getmxrr($domain, $MXHost)) {
             $this->contactStatus = $translator->translate('mail_invalide');
         } else {
             $mail = new Mailer();
             $mail->addRecipient('*****@*****.**', '');
             $mail->addFrom($email, '');
             $mail->addSubject($_POST['mail_title'], '');
             $mail->html = "<table><tr><td>" . utf8_decode('Identité') . " :<br/>====================</td></tr>" . "<tr><td>{$_POST['mail_sender']}<br/></td></tr>" . "<tr><td>Message :<br/>====================</td></tr>" . "<tr><td>" . nl2br(htmlspecialchars(utf8_decode($_POST['mail_message']))) . "</td></tr></table>";
             if (!$mail->send()) {
                 $this->contactStatus = $mail->errorLog();
             }
         }
     }
 }