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

View File

@ -41,6 +41,7 @@ class install extends common {
else {
// Soumission du formulaire
if($this->isPost()) {
//$sent = $success = false;
// 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)) {
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-troisieme-article', 'userId', $userId]);
}
$this->setData([
$success = $this->setData([
'user',
$userId,
[
@ -71,29 +72,31 @@ class install extends common {
'password' => $this->getInput('installPassword', helper::FILTER_PASSWORD, true)
]
]);
// phpMailer
require_once "core/vendor/phpmailer/phpmailer.php";
require_once "core/vendor/phpmailer/exception.php";
// Envoie le mail
$sent = $this->sendMail(
$userMail,
'Installation de votre site',
'Bonjour' . ' <strong>' . $userFirstname . ' ' . $userLastname . '</strong>,<br><br>' .
'Voici les détails de votre installation.<br><br>' .
'<strong>URL du site :</strong> <a href="' . helper::baseUrl(false) . '" target="_blank">' . helper::baseUrl(false) . '</a><br>' .
'<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();
// Créer sitemap
$this->createSitemap('all');
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl(false),
'notification' => ($sent === true ? 'Installation terminée' : $sent),
'state' => ($sent === true ? true : null)
]);
if ($success === true) { // Formulaire complété envoi du mail
// phpMailer
require_once "core/vendor/phpmailer/phpmailer.php";
require_once "core/vendor/phpmailer/exception.php";
// Envoie le mail
$sent = $this->sendMail(
$userMail,
'Installation de votre site',
'Bonjour' . ' <strong>' . $userFirstname . ' ' . $userLastname . '</strong>,<br><br>' .
'Voici les détails de votre installation.<br><br>' .
'<strong>URL du site :</strong> <a href="' . helper::baseUrl(false) . '" target="_blank">' . helper::baseUrl(false) . '</a><br>' .
'<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();
// Créer sitemap
$this->createSitemap('all');
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl(false),
'notification' => ($sent === true ? 'Installation terminée' : $sent),
'state' => ($sent === true ? true : null)
]);
}
}
// Valeurs en sortie