VALUES ({?}, NOW(), {?})',
$user->id(), $hash);
- $mymail = new PlMailer();
- $mymail->setFrom('"Gestion des mots de passe" <support+password@' . Platal::globals()->mail->domain . '>');
+ $mymail = new PlMailer('platal/password_recovery_xnet.mail.tpl');
$mymail->addTo($user);
- $mymail->setSubject("Votre certificat d'authentification");
- $mymail->setTxtBody("Visitez la page suivante qui expire dans six heures :
-https://www.polytechnique.org/tmpPWD/$hash
-
-Si en cliquant dessus vous n'y arrivez pas, copiez intégralement l'adresse dans la barre de votre navigateur. Si vous n'avez pas utilisé ce lien dans six heures, vous pouvez tout simplement recommencer cette procédure.
-
---
-Polytechnique.org
-\"Le portail des élèves & anciens élèves de l'École polytechnique\"
-
-Email envoyé à " . Post::t('login'));
+ $mymail->assign('hash', $hash);
+ $mymail->assign('email', Post::t('login'));
$mymail->send();
S::logger($user->id())->log('recovery', $user->bestEmail());
{
XDB::execute('DELETE FROM register_pending_xnet
WHERE DATE_SUB(NOW(), INTERVAL 1 MONTH) > date');
- $res = XDB::fetchOneAssoc('SELECT uid, hruid
+ $res = XDB::fetchOneAssoc('SELECT uid, hruid, email
FROM register_pending_xnet
WHERE hash = {?}',
$hash);
}
if (Post::has('pwhash') && Post::t('pwhash')) {
+ XDB::startTransaction();
XDB::query('UPDATE accounts
SET password = {?}, state = \'active\', registration_date = NOW()
WHERE uid = {?} AND state = \'pending\' AND type = \'xnet\'',
Post::t('pwhash'), $res['uid']);
XDB::query('DELETE FROM register_pending_xnet
WHERE uid = {?}',
- $res['uid']);
+ $res['uid']);
+ XDB::commit();
S::logger($res['uid'])->log('passwd', '');
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2011 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="password_recovery_xnet"}
+{if $mail_part eq 'head'}
+{subject text="Votre certificat d'authentification"}
+{from full=#from#}
+{elseif $mail_part eq 'text'}
+
+Visitez la page suivante qui expire dans six heures :
+{$globals->baseurl}/tmpPWD/{$hash}
+
+Si en cliquant dessus vous n'y arrivez pas, copiez intégralement l'adresse dans la barre de votre navigateur. Si vous n'avez pas utilisé ce lien dans six heures, vous pouvez tout simplement recommencer cette procédure.
+
+{include file="include/signature.mail.tpl"}
+
+Email envoyé à {$email}
+{/if}