2

In my magento site I have enabled Captcha for Forgot Password form of custom theme, but when I try to reset password with providing correct captcha code in the field, even then it shows "Incorrect Captcha" after refreshing & redirecting to same page.

I'm using magento-2-social-login

No warnings/errors either in the client or server.

Any suggestions please?

enter image description here

3

After every action Magento does refresh captcha session so if any Ajax URL run and you open your forgot password then at that time captcha session will be changed that's why you are getting error. Just click on reload captcha button and then refill again to proceed successfully.

You can add scripts to reload captcha when that from open so you will not get error again.

You can manually trigger reload by this

$('.action.captcha-reload'). trigger ('click');
| improve this answer | |
1

I've adding custom script that can be reloading the captcha image.

In:

/app/design/frontend/name_space/theme_name/Magento_Customer/templates/form/forgotpassword.phtml

Custom script:

jQuery( "captcha-button-selector" ).trigger( "click" );

Then it's solved my problem.

@Kumar thanks.

| improve this answer | |
  • 1
    Welcome @mahmoudismail I also edited my answer. – Kumar M Jan 24 '18 at 12:14
  • captcha-button-selector what is this.. i used this code but not working – Maruti_magento2 Dec 10 '19 at 10:36
  • @Maruti_magento2 captcha-button-selector is the button class name or Button Id – mahmoudismail Dec 10 '19 at 12:02
1

Here is the whole script. I have added jQuery bind concept to reload captcha when forgot password page is loaded.

Here is the path to add the below script.

/app/design/frontend/NAMESPACE/YOURTHEME/Magento_Customer/templates/form/forgotpassword.phtml

<script>
require(["jquery"], function ($) {
    // Reload captcha when page loaded
    $(window).bind("load", function() {
        // Use setTimeout to trigger captcha reload.
        setTimeout(function () {
            $(".action.captcha-reload").trigger("click");
        }, 2000);
    });
});

| improve this answer | |
0

First, check if you enabled default captcha or not. If it is enabled then Disable that, then it will work.

| improve this answer | |
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – Jai Feb 10 at 21:09
  • This one solved that error for me. – Kowsigan Atsayam Feb 11 at 9:25

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.