I am building a widget to allow the Login form to display on a CMS page. I am able to get the form to display, but when I try to login, I am redirected to the customer/account page and get the error "invalid Captcha". Captcha is turned on and works just fine on the customer/account page.


    namespace Vendor\Module\Block\Widget;

    use Magento\Framework\View\Element\Template;
    use Magento\Widget\Block\BlockInterface;

    class Login extends Template implements BlockInterface
        protected $_template = "widget/login.phtml";



    echo $this->getLayout()->createBlock("Magento\Customer\Block\Form\Login")->setTemplate("Magento_Customer::form/login.phtml")->toHtml();

Form on CMS Page:

Form on CMS Page

Form on customer/account: customer/account

1 Answer 1


Anyone? I also need an answer on this. Trying the same with the registration-page: problem is, that the captcha is not loaded when called via createBlock.

How to fix this?

EDIT: I found the solution finally after days. It must be exakt this code, to insert also the reCaptcha as a block, here i.e. für the register-page:

echo $this->getLayout()
    ['data' =>
            'jsLayout' =>
                    'components' =>
                            'msp-recaptcha' =>
                                    'component' => 'MSP_ReCaptcha/js/reCaptcha',
                                    'reCaptchaId' => 'msp-recaptcha',
                                    'zone' => 'create'
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review Oct 20, 2022 at 13:13
  • What are you talking about? I didnt ANSWERED the question, NOBODY does. So i just added some input for another, but same, case, so someone maybe knows the answer! Oct 20, 2022 at 14:04
  • did you tried directly use of captcha in form with jquery? Oct 26, 2022 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.