10.3.00 module installation corrections

This commit is contained in:
Fred Tempez 2020-09-09 14:23:05 +02:00
parent 19af48b777
commit 711e5fef44
1 changed files with 23 additions and 21 deletions

View File

@ -37,12 +37,13 @@ class user extends common {
public function add() { public function add() {
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
$check=true; $check = true;
$sent = false;
// L'identifiant d'utilisateur est indisponible // L'identifiant d'utilisateur est indisponible
$userId = $this->getInput('userAddId', helper::FILTER_ID, true); $userId = $this->getInput('userAddId', helper::FILTER_ID, true);
if($this->getData(['user', $userId])) { if($this->getData(['user', $userId])) {
self::$inputNotices['userAddId'] = 'Identifiant déjà utilisé'; self::$inputNotices['userAddId'] = 'Identifiant déjà utilisé';
$check=false; $check = false;
} }
// Double vérification pour le mot de passe // Double vérification pour le mot de passe
if($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) { if($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
@ -54,12 +55,14 @@ class user extends common {
$userLastname = $this->getInput('userAddLastname', helper::FILTER_STRING_SHORT, true); $userLastname = $this->getInput('userAddLastname', helper::FILTER_STRING_SHORT, true);
$userMail = $this->getInput('userAddMail', helper::FILTER_MAIL, true); $userMail = $this->getInput('userAddMail', helper::FILTER_MAIL, true);
// Pas de nom saisi // Pas de nom saisi
if (empty($userFirstname) || if (empty($userFirstname)
empty($userLastname) || OR empty($userLastname)
empty($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true)) || OR empty($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true))
empty($this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true))) { OR empty($this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) )
$check=false; {
$check = false;
} }
// Si tout est ok création effective // Si tout est ok création effective
if ($check === true) { if ($check === true) {
$this->setData([ $this->setData([
@ -74,9 +77,7 @@ class user extends common {
'password' => $this->getInput('userAddPassword', helper::FILTER_PASSWORD, true), 'password' => $this->getInput('userAddPassword', helper::FILTER_PASSWORD, true),
] ]
]); ]);
}
// Envoie le mail // Envoie le mail
$sent = true;
if($this->getInput('userAddSendMail', helper::FILTER_BOOLEAN) && $check === true) { if($this->getInput('userAddSendMail', helper::FILTER_BOOLEAN) && $check === true) {
$sent = $this->sendMail( $sent = $this->sendMail(
$userMail, $userMail,
@ -89,6 +90,7 @@ class user extends common {
null null
); );
} }
}
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . 'user', 'redirect' => helper::baseUrl() . 'user',