Skip to content

Commit

Permalink
AForm: captcha validation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abolabo committed Dec 24, 2023
1 parent 16c3610 commit 934b360
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion public_html/core/engine/form.php
Expand Up @@ -632,6 +632,7 @@ public function getFormHtml($fieldsOnly = false)
*/
public function validateFormData($data = [])
{

$errors = [];
$this->_loadFields();
$this->load->language('checkout/cart'); // load language for file upload text errors
Expand Down Expand Up @@ -685,7 +686,7 @@ public function validateFormData($data = [])
if ($field['element_type'] == 'K' || $field['element_type'] == 'J') {
if ($this->config->get('config_recaptcha_secret_key')) {
$recaptcha = new ReCaptcha($this->config->get('config_recaptcha_secret_key'));
$resp = $recaptcha->verify($data['g-recaptcha-response'], $this->request->getRemoteIP());
$resp = $recaptcha->verify($data['g-recaptcha-response']?:$data['captcha'], $this->request->getRemoteIP());
if (!$resp->isSuccess() && $resp->getErrorCodes()) {
$errors[$field['field_name']] = $this->language->get('error_captcha');
}
Expand Down

0 comments on commit 934b360

Please sign in to comment.