Skip to content

Commit 0a2fad2

Browse files
vertexvaareinpraegsam
authored andcommitted
[BUGFIX] Skip captcha validation of persisted mails (fixes #376)
Resolves: #376 Resolves: https://projekte.in2code.de/issues/44174
1 parent 329c50e commit 0a2fad2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Classes/Domain/Validator/CaptchaValidator.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,16 @@ public function isValid($mail)
5353
/** @var Answer $answer */
5454
if ($answer->getField()->getType() === 'captcha') {
5555
$this->setCaptchaArgument(true);
56-
if (!$this->validCodePreflight($answer->getValue(), $answer->getField())) {
57-
$this->setErrorAndMessage($answer->getField(), 'captcha');
56+
/* If the answer has a UID it has already been validated an persisted.
57+
* There's no reason to validate it twice. Also, there's no possibility, since the value to check
58+
* against got removed from the user's session on the first validation.
59+
* Resolves: https://github.com/einpraegsam/powermail/issues/376
60+
* Resolves: https://projekte.in2code.de/issues/44174
61+
*/
62+
if (null === $answer->getUid()) {
63+
if (!$this->validCodePreflight($answer->getValue(), $answer->getField())) {
64+
$this->setErrorAndMessage($answer->getField(), 'captcha');
65+
}
5866
}
5967
}
6068
}

0 commit comments

Comments
 (0)