public function validCodeForgetPasswordAction()
 {
     $translate = $this->application->get('translator');
     if (empty($_POST['code'])) {
         $err_msg = $translate->translate('fields_empty');
     } else {
         $db = $this->application->get('database_connection');
         if ($db->count('recovery', " WHERE code={$_POST['code']} AND login='******'memo_login']}'") === 0) {
             $err_msg = $translate->translate('no_result');
         } else {
             $email = $db->select("SELECT email FROM Utilisateurs WHERE login='******'memo_login']}'");
             if (count($email) === 0) {
                 $err_msg = $translate->translate('no_result');
             } else {
                 $new_pwd = $this->createPassword();
                 $mail = new Mailer();
                 $mail->addRecipient($email[0]['email'], '');
                 $mail->addFrom('*****@*****.**', '');
                 $mail->addSubject('8thwonderland - ' . $translate->translate('forget_pwd'), '');
                 $mail->html = $translate->translate('mail_newpwd') . $new_pwd;
                 if (!$mail->envoi()) {
                     $err_msg = $mail->error_log();
                 } else {
                     $db->query("UPDATE Utilisateurs SET password='******'sha512', $new_pwd) . "' WHERE login='******'memo_login']}'");
                     if ($db->affected_rows == 0) {
                         // log d'échec de mise à jour
                         $logger = $this->application->get('logger');
                         $logger->setWriter('db');
                         $logger->log("Echec de changement du mot de passe ({$_POST['memo_login']})", Log::ERR);
                     }
                 }
             }
         }
     }
     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('<div class="info" style="padding:3px"><table style="width:70%"><tr>' . '<td><img alt="info" src="' . ICO_PATH . '64x64/Info.png" style="width:24px;"/></td>' . '<td><span style="font-size: 13px;">' . $translate->translate('reponse_newpwd') . '</span></td>' . '</tr></table></div>');
 }