Skip to content

Commit

Permalink
check repcatcha only in case a recaptcha secret is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Nov 25, 2023
1 parent 0ea094b commit 0b42a45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion www/src/Controller/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public function generate(Model\Generate $payload): mixed
$repository = $this->generatorFactory->factory();

try {
if (!$this->captchaVerifier->verify($payload->getGRecaptchaResponse())) {
$recaptchaSecret = $this->config->get('recaptcha_secret');
if (!empty($recaptchaSecret) && !$this->captchaVerifier->verify($payload->getGRecaptchaResponse())) {
throw new BadRequestException('Invalid captcha');
}

Expand Down

0 comments on commit 0b42a45

Please sign in to comment.