From ea48b853cb294457d45f0505148a773af4f8ce19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Fri, 3 Jan 2025 21:20:56 +0100 Subject: [PATCH] suscribe 2.6 bug approbation --- suscribe/changes.md | 2 ++ suscribe/enum.json | 2 +- suscribe/suscribe.php | 39 +++++++++++++++++++++------------------ 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/suscribe/changes.md b/suscribe/changes.md index 307e70a..697608f 100644 --- a/suscribe/changes.md +++ b/suscribe/changes.md @@ -1,3 +1,5 @@ +# Version 2.6 +- Corrige d'un bug empêchat de terminer la procédure d'inscription après approbation. # Version 2.5 - Reformatage du formulaire d'approbation pour mettre en avant les actions à réaliser par l'administrateur. # Version 2.4 diff --git a/suscribe/enum.json b/suscribe/enum.json index 647e644..06b7bb0 100644 --- a/suscribe/enum.json +++ b/suscribe/enum.json @@ -1 +1 @@ -{"name":"suscribe","realName":"Auto Inscription","version":"2.5","update":"0.0","delete":true,"dataDirectory":""} \ No newline at end of file +{"name":"suscribe","realName":"Auto Inscription","version":"2.6","update":"0.0","delete":true,"dataDirectory":""} \ No newline at end of file diff --git a/suscribe/suscribe.php b/suscribe/suscribe.php index 259fc14..91f7a88 100644 --- a/suscribe/suscribe.php +++ b/suscribe/suscribe.php @@ -15,7 +15,7 @@ class suscribe extends common { - const VERSION = '2.5'; + const VERSION = '2.6'; const REALNAME = 'Auto Inscription'; const DELETE = true; const UPDATE = '0.0'; @@ -146,23 +146,16 @@ class suscribe extends common 'mail' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'mail']), 'password' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'password']), 'tags' => $this->getInput('registrationUserLabel', helper::FILTER_STRING_SHORT), - 'connectFail' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'connectFail']), - 'connectTimeout' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'connectTimeout']), - 'accessUrl' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessUrl']), - 'accessTimer' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessTimer']), - 'accessCsrf' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessCsrf']) ] ]); - // Notifier le user uniquement si le groupe est membre au moins membre - if ($this->getInput('registrationUserEditGroup') >= 1) { - $this->sendMail( - $this->getData(['module', $this->getUrl(0), 'users', 'mail']), - 'Approbation de l\'inscription', - '

' . $this->getdata(['module', $this->getUrl(0), 'config', 'mailValidateContent']) . '

', - null, - $this->getData(['config', 'smtp', 'from']) - ); - } + // Notifier le user + $this->sendMail( + $this->getData(['module', $this->getUrl(0), 'users', 'mail']), + 'Approbation de l\'inscription', + '

' . $this->getdata(['module', $this->getUrl(0), 'config', 'mailValidateContent']) . '

', + null, + $this->getData(['config', 'smtp', 'from']) + ); // Supprimer le user de la base temporaire, $this->deleteData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]); // Valeurs en sortie @@ -411,10 +404,9 @@ class suscribe extends common $check && $this->getInput('registrationValidPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('registrationValidConfirmPassword', helper::FILTER_STRING_SHORT, true) ) { - self::$inputNotices['registrationAddConfirmPassword'] = 'Les mots de passe ne sont pas identiques'; + self::$inputNotices['registrationValidConfirmPassword'] = 'Les mots de passe ne sont pas identiques'; $check = false; } - if ($check) { if ( // Pas d'approbation par un administrateur @@ -444,8 +436,19 @@ class suscribe extends common // Approbation nécessaire $this->setData(['module', $this->getUrl(0), 'users', $userId, 'status', self::STATUS_ACCOUNT_AWAITING]); $notification = 'L\'inscription doit être approuvée par un administrateur'; + // Stocker le mot de passe temporairement + $this->setData([ + 'module', + $this->getUrl(0), + 'users', + $userId, + 'password', + $this->getInput('registrationValidPassword', helper::FILTER_PASSWORD, true), + ]); + } } + // Valeurs en sortie $this->addOutput([ 'redirect' => $check ? helper::baseUrl() . $this->getdata(['module', $this->getUrl(0), 'config', 'pageSuccess']) : helper::baseUrl() . $this->getdata(['module', $this->getUrl(0), 'config', 'pageError']),