Open Closed

ReCAPTCHAv2 error when using custom Register page #6679


User avatar
0
mattw@agilenova.com created

Hello,

I wanted to improve model validation during user registration (e.g. set a regex for Username). I copied the Register.cshtml into HttpApi.Host/Pages/Account and changed @model to use my custom model. All field validations are working, password complexity is working, reCAPTCHA allows me to click the check box (I'm not a robot) but immediately displays an error: ReCAPTCHA couldn't find user-provided function: (function(){$('#g-recaptcha-response').val(token)})

I am using ReCAPTCHAv2 and the Register.cshtml changes are limited to @model.

_ViewImports.cshtml in the same directory has: @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling @addTagHelper *, Owl.reCAPTCHA

Please let me know if there is anything else I can check.

Thanks, Matt

  • ABP Framework version: v8.0.3
  • UI Type: Angular
  • Database System: EF Core PostgreSQL
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace: *Browser Console Error: ReCAPTCHA couldn't find user-provided function: (function(){$('#g-recaptcha-response').val(token)})
  • Steps to reproduce the issue:
  • Provide custom registration model, use Register.cshtml from commercial source (with @model change)

4 Answer(s)
  • User Avatar
    0
    mattw@agilenova.com created

    A quick update. I am still getting the JS console error listed above, but I am able to register the user now.

    I had originally overridden protected override async Task<IdentityUser> RegisterLocalUserAsync() with the community source code. I just replaced the community source code with the commercial source code (which has captcha support) and am able to register the user. This is the only method that I had to override in class CustomRegisterModel : RegisterModel.

    I am still interested in knowing what is causing the *Browser Console Error: ReCAPTCHA couldn't find user-provided function: (function(){$('#g-recaptcha-response').val(token)}). The Register.cshtml was taken verbatim from commercial source and only the @model was updated.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Provide custom registration model, use Register.cshtml from commercial source (with @model change)

    Could you share your code?

  • User Avatar
    0
    mattw@agilenova.com created

    Can I post ABP commercial source code here or should I email?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    My email is shiwei.liang@volosft.com

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15