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