reCAPTCHA icon indicating copy to clipboard operation
reCAPTCHA copied to clipboard

ASP.NET Core 3.0 support

Open hikalkan opened this issue 5 years ago • 4 comments

Hi,

Any work to support ASP.NET Core 3.0?

Thanks.

hikalkan avatar Sep 25 '19 12:09 hikalkan

Hi. I think the project is die.

taras-kolodchyn avatar Nov 01 '19 09:11 taras-kolodchyn

if any new reCaptcha library that supports .Core 3.0 comes up please notify me !

ebicoglu avatar Nov 12 '19 18:11 ebicoglu

Hi, seems like there's simply some kind of change in the way that views are rendered in development. In production - the library is working as intended (though i have "CompileOnPublish" deactivated by default for another reason).

If you want to continue using it - and don't mind missing the feature during development - you can easily create a custom attribute, that ignores captcha-validation for the Development-Environment: using System; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using PaulMiami.AspNetCore.Mvc.Recaptcha;

namespace FluiTec.AppFx.WildServer.Attributes { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class ValidateRecaptchaAttributeIgnoreDevelopment : Attribute, IFilterFactory, IOrderedFilter { public bool IsReusable => true;

    public int Order { get; set; }

    public IFilterMetadata CreateInstance(IServiceProvider serviceProvider)
    {
        var environment = serviceProvider.GetRequiredService<IWebHostEnvironment>();
        if (!environment.IsDevelopment())
            return serviceProvider.GetRequiredService<ValidateRecaptchaFilter>();
        return new DontValidateRecaptchaFilter();
    }
}

public class DontValidateRecaptchaFilter : IFilterMetadata
{

}

}

IInvocation avatar Nov 23 '19 17:11 IInvocation

I have published a new version compatible with aspnet core 3.1, Let me know if you find any issues with it

PaulMiami avatar Jan 30 '20 12:01 PaulMiami