LSformElement::password: fix multiple sent email in some cases

This commit is contained in:
Benjamin Renard 2021-11-15 18:38:40 +01:00
parent 2d27a7049f
commit d15fdc5d8e

View file

@ -307,7 +307,8 @@ class LSformElement_password extends LSformElement {
} }
public function send($params) { public function send($params) {
if (is_array($this -> sendMail)) { if (!is_array($this -> sendMail))
return true;
$mail = (String)$this -> sendMail['mail']; $mail = (String)$this -> sendMail['mail'];
self :: log_debug("send(): mail from params: '$mail'"); self :: log_debug("send(): mail from params: '$mail'");
if (!$mail) { if (!$mail) {
@ -356,14 +357,14 @@ class LSformElement_password extends LSformElement {
$headers $headers
)) { )) {
LSsession :: addInfo(_('Notice mail sent.')); LSsession :: addInfo(_('Notice mail sent.'));
// Set $this -> sendMail to false to avoid potential multiple sent email
$this -> sendMail = false;
} }
else { else {
LSerror :: addErrorCode('LSformElement_password_02', $mail); LSerror :: addErrorCode('LSformElement_password_02', $mail);
return; return;
} }
} }
return true;
}
public static function ajax_verifyPassword(&$data) { public static function ajax_verifyPassword(&$data) {
if ( if (