[10.0.36.dev] stoppe l'envoi du mail lorsque le mot de passe est erroné

This commit is contained in:
fredtempez 2019-10-19 19:44:48 +02:00
parent ad970c0f3b
commit 5d880fa2da
2 changed files with 30 additions and 26 deletions

View File

@ -31,7 +31,7 @@ class common {
const TEMP_DIR = 'site/tmp/'; const TEMP_DIR = 'site/tmp/';
// Numéro de version // Numéro de version
const ZWII_VERSION = '10.0.35.dev'; const ZWII_VERSION = '10.0.36.dev';
public static $actions = []; public static $actions = [];
public static $coreModuleIds = [ public static $coreModuleIds = [
@ -917,7 +917,7 @@ class common {
// Pas d'enregistrement lorsque'une notice est présente // Pas d'enregistrement lorsque'une notice est présente
if (!empty(self::$inputNotices)) { if (!empty(self::$inputNotices)) {
return; return false;
} }
//Retourne une chaine contenant le dossier à créer //Retourne une chaine contenant le dossier à créer
@ -957,6 +957,7 @@ class common {
$db->save(); $db->save();
break; break;
} }
return true;
} }
/** /**

View File

@ -41,6 +41,7 @@ class install extends common {
else { else {
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
//$sent = $success = false;
// Double vérification pour le mot de passe // Double vérification pour le mot de passe
if($this->getInput('installPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('installConfirmPassword', helper::FILTER_STRING_SHORT, true)) { if($this->getInput('installPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('installConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
self::$inputNotices['installConfirmPassword'] = 'Incorrect'; self::$inputNotices['installConfirmPassword'] = 'Incorrect';
@ -59,7 +60,7 @@ class install extends common {
$this->setData(['module', 'blog', 'mon-deuxieme-article', 'userId', $userId]); $this->setData(['module', 'blog', 'mon-deuxieme-article', 'userId', $userId]);
$this->setData(['module', 'blog', 'mon-troisieme-article', 'userId', $userId]); $this->setData(['module', 'blog', 'mon-troisieme-article', 'userId', $userId]);
} }
$this->setData([ $success = $this->setData([
'user', 'user',
$userId, $userId,
[ [
@ -71,29 +72,31 @@ class install extends common {
'password' => $this->getInput('installPassword', helper::FILTER_PASSWORD, true) 'password' => $this->getInput('installPassword', helper::FILTER_PASSWORD, true)
] ]
]); ]);
// phpMailer if ($success === true) { // Formulaire complété envoi du mail
require_once "core/vendor/phpmailer/phpmailer.php"; // phpMailer
require_once "core/vendor/phpmailer/exception.php"; require_once "core/vendor/phpmailer/phpmailer.php";
// Envoie le mail require_once "core/vendor/phpmailer/exception.php";
$sent = $this->sendMail( // Envoie le mail
$userMail, $sent = $this->sendMail(
'Installation de votre site', $userMail,
'Bonjour' . ' <strong>' . $userFirstname . ' ' . $userLastname . '</strong>,<br><br>' . 'Installation de votre site',
'Voici les détails de votre installation.<br><br>' . 'Bonjour' . ' <strong>' . $userFirstname . ' ' . $userLastname . '</strong>,<br><br>' .
'<strong>URL du site :</strong> <a href="' . helper::baseUrl(false) . '" target="_blank">' . helper::baseUrl(false) . '</a><br>' . 'Voici les détails de votre installation.<br><br>' .
'<strong>Identifiant du compte :</strong> ' . $this->getInput('installId') . '<br>' . '<strong>URL du site :</strong> <a href="' . helper::baseUrl(false) . '" target="_blank">' . helper::baseUrl(false) . '</a><br>' .
'<strong>Mot de passe du compte :</strong> ' . $this->getInput('installPassword') '<strong>Identifiant du compte :</strong> ' . $this->getInput('installId') . '<br>' .
); '<strong>Mot de passe du compte :</strong> ' . $this->getInput('installPassword')
// Générer un fichier robots.txt );
$this->createRobots(); // Générer un fichier robots.txt
// Créer sitemap $this->createRobots();
$this->createSitemap('all'); // Créer sitemap
// Valeurs en sortie $this->createSitemap('all');
$this->addOutput([ // Valeurs en sortie
'redirect' => helper::baseUrl(false), $this->addOutput([
'notification' => ($sent === true ? 'Installation terminée' : $sent), 'redirect' => helper::baseUrl(false),
'state' => ($sent === true ? true : null) 'notification' => ($sent === true ? 'Installation terminée' : $sent),
]); 'state' => ($sent === true ? true : null)
]);
}
} }
// Valeurs en sortie // Valeurs en sortie