Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

What is the correct way to bypass reCaptcha in development environment #10

Open
blaiseliu opened this issue Nov 9, 2017 · 1 comment

Comments

@blaiseliu
Copy link

blaiseliu commented Nov 9, 2017

I have a bool setting in Web.Config to decide if bypass would happen.

Then I copied your ActionFilter EasyGCaptcha and added these lines of code:

var isByPassed = Settings.Default.BypassCaptchaInDebugMode;
if (isByPassed)
{
    filterContext.ActionParameters["easyGCaptchaResult"] =
        new EasyGCaptchaResult {Date = DateTime.Now, GErrorCodes = null, Success = true};
    return;
}

Only to find out the EasyGCaptchaResult.Success is an internal get;.

In the extension, there is a property called UsePassthruInDebugMode. How to use it? Any documentation or example code?

What is your preferred way to bypass reCaptcha? I just need it for Selenium.

Thanks.

@stefmde
Copy link
Owner

stefmde commented Nov 10, 2017

There is no build in way to bypass it from the frontend because that would be a big security issue.
You can use multiple ways to pass thru the validation. But please understand that right "Bypass" or "PassThru" only means that google will always respond with a "success". That is the build in way from google for testing to keep the test conditions as near as possible to the "production". So even if the ByPass mode is enabled you still have to click on the captcha. Or you dont have to if you use the invisible captcha with the size parameter.
By default the bypass is used in debugging mode:

public bool UsePassthruInDebugMode { get; set; } = true;

If you dont want you site always in debugging mode in VisualStudio while testing, you can host you site in an IIS or someting like that and set the following parameter to always pypass:

public ForcedConfigurationMode ForcedConfigurationMode { get; set; } = ForcedConfigurationMode.None;

My code is well documented if you check the github sources, with samples on the project start page or you cann check the demo project: https://github.com/stefmde/EasyGCaptchaMVC/tree/master/EasyGCaptchaMVC.Demo

Hope that helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants