Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.9.4] Freeform/form/properties/[id] endpoint does not return a captcha data #1774

Open
Stalex89 opened this issue Jan 31, 2025 · 1 comment
Assignees
Labels
confirmed bug Bug has been confirmed fixing Currently working in a fix for the issue

Comments

@Stalex89
Copy link

Stalex89 commented Jan 31, 2025

What happened?

According to a docs on how to create PHP endpoints modile for a headless website Freeform module endpoint will return a captcha data in the JSON response

After following the steps we've created module with endpoints, however /freeform/form/properties/[form_id] does not return the captcha value.

  1. Captcha is enabled (both by default and on te form itself)
  2. Keys are valid (tested by pasting the keys directly in the frontend)

code from PHP module:

/modules/freeform-module/Module.php

<?php

namespace FreeformModule;

use Craft;

class Module extends \yii\base\Module
{
    public function init()
    {
        Craft::setAlias('@modules', __DIR__);

        if (Craft::$app->getRequest()->getIsConsoleRequest()) {
            $this->controllerNamespace = 'FreeformModule\\console\\controllers';
        } else {
            $this->controllerNamespace = 'FreeformModule\\controllers';
        }

        parent::init();
    }
}

/modules/freeform-module/controllers/FormController.php

<?php

namespace FreeformModule\controllers;

use craft\web\Controller;
use Solspace\Freeform\Freeform;
use yii\web\Response;

class FormController extends Controller
{
    protected array|bool|int $allowAnonymous = true;

    public function actionIndex(): string
    {
        return 'Welcome to the Craft Freeform Form Controller';
    }

    public function actionProperties(int $formId): Response
    {
        $form = Freeform::getInstance()->forms->getFormById($formId);

        if ($form) {
            return $this->asJson($form->toArray());
        }

        return $this->asJson(['message' => 'Form was not found']);
    }
}

Screenshots from the plugin:

Image
Image

Screenshot from the GraphQL (captcha is visible there):

Image

Screenshot from the /freeform/form/properties/[form_id] route response:

Image

Could you please have a look on it?

Thank you in advance!

Errors and Stack Trace (if available)

How can we reproduce this?

  1. Configure reCAPTCHA in the Plugin Settings (enable by default)
  2. Create a form with enabled captha
  3. Follow the steps for Creating PHP endpoint for headless website
  4. Hit the /freeform/form/properties/[form_id] route to see if "captcha" values are visible in the response

Freeform Edition

Pro

Freeform Version

5.9.4

Craft Version

4.14.3

When did this issue start?

No response

Previous Freeform Version

No response

@Stalex89 Stalex89 changed the title [5.x.x] Freeform/form/properties/[id] endpoint does not return a captcha data [4.x.x] Freeform/form/properties/[id] endpoint does not return a captcha data Jan 31, 2025
@Stalex89 Stalex89 changed the title [4.x.x] Freeform/form/properties/[id] endpoint does not return a captcha data [5.9.4] Freeform/form/properties/[id] endpoint does not return a captcha data Jan 31, 2025
@kjmartens
Copy link
Contributor

Sorry for this as well, @Stalex89.

We'll sort this out early next week. 🙂

@kjmartens kjmartens added confirmed bug Bug has been confirmed fixing Currently working in a fix for the issue labels Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed bug Bug has been confirmed fixing Currently working in a fix for the issue
Development

No branches or pull requests

3 participants