4

I'm using magento 2.2, I've enabled Admin-Panel -> Store -> Customers -> Customer Configuration -> CAPTCHA and enabled it for following forms: "Create user", "Login", "Forgot password".

The "Login" case: The captcha works well on default theme (LUMA theme).But when I'm using another theme, the Captcha image (or the Captcha form with message and image) is not showed up, and I'm ending up with "Incorrect CAPTCHA".

I tried to find any related forum thread about this, but I wasn't able to find something that is well described. I checked all file permissions and those are OK, I've checked magento logs no exception there.

My theme has the following structure: /app/code /app/design/frontend/Theme_name/some_name/

  • This contain (beside others folders and files like /etc and so on) a theme.xml file that point to the parent_theme folder /app/design/frontend/Theme_name/parent_theme

On the parent_theme I have the /parent_theme/Magento_Customer/layout - this contains "customer_account_login.xml" which is almost identical with the one from -> customer_account_login.xml and to what I have on Magento-CE-2.2.2-2017-12-11-09-19-32/vendor/magento/module-customer/view/frontend/layout/customer_account_login.xml

From what I could understand here will fill with the captcha form.

<container name="customer.login.container.before" htmlTag="div" htmlClass="col-sm-6 col-xs-12" before="-">
                    <block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="form/login.phtml">
                        <container name="form.additional.info" as="form_additional_info"/>
                    </block>
</container>





     parent_theme/Magento_Customer/layout/templates/form/login.phtml    - which is similar to [login.phtml][1]
  • In this file I have the getChildHtml('form_additional_info') ?>, only design is different.

I tried everything, I also overwrite those file with default one (from https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Customer/view/frontend/), design was changing but Captcha form wasn't showing up.

I tend to think that my theme is missing something, I read somewhere that captcha layout should be overwrite in order to make it visible but no detailed on how to do that.

Can someone who hit this problem, or has experience on making themes let me know what I'm missing?

Thanks,

4

I was facing the same issue before and in my case it was caused by my theme's customer_account_login.xml file.

For example, if your theme is extending Magento_Blank theme, then you don't need to copy the entire contents of the customer_account_login.xml file to your theme to make changes to it --> this will "bug out" the CAPTCHA form.

The proper way to make changes is to use <referenceBlock> and <referenceContainer> to add, remove or move the elements as you want.

You can read instructions here on how to do that: http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/layouts/xml-instructions.html

If you are facing the same issue, you can quickly test it by renaming/removing your theme's customer_account_login.xml and clearing cache.

Then you can make the customizations the proper way based on the official documentation.

  • 1
    You were right. I just renamed the file from customer_account_login.xml to something else and this fixed my problem (It was exactly your scenario). Thank you, you made my day ! – Mike Feb 4 '18 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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