Skip to content

Commit 73be589

Browse files
authored
Merge pull request #133 from /issues/132
security-package/issues/132: $validationErrors is undefined in \Magento\ReCaptchaValidation\Model\Validator
2 parents 35ec79e + 5825411 commit 73be589

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ReCaptchaValidation/Model/Validator.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,13 @@ public function isValid(
6060
}
6161
$result = $reCaptcha->verify($reCaptchaResponse, $validationConfig->getRemoteIp());
6262

63-
if ($result->isSuccess()) {
64-
$validationResult = $this->validationResultFactory->create(['errors' => []]);
65-
} else {
63+
$validationErrors = [];
64+
if (!$result->isSuccess()) {
6665
foreach ($result->getErrorCodes() as $errorCode) {
6766
$validationErrors[] = $this->errorMessages->getErrorMessage($errorCode);
6867
}
69-
$validationResult = $this->validationResultFactory->create(['errors' => $validationErrors]);
7068
}
71-
return $validationResult;
69+
70+
return $this->validationResultFactory->create(['errors' => $validationErrors]);
7271
}
7372
}

0 commit comments

Comments
 (0)