最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I implement ReCaptcha in a Single Page Application (SPA) - Stack Overflow

programmeradmin2浏览0评论

I have a Single Page Application (SPA) I would like to add ReCaptcha to. This application is hosted using IIS as flat Html, Css & Javascript, this SPA in turn talks to a separate REST server (using CORS) for all dynamic content.

The REST server is written using ASP WebAPI. The problem is; all examples I have seen of ReCaptcha all use ASP MVC (or other languages) to inject html into the webpage, I cannot modify the webpage using ASP in this manor. Hopefully someone else has had the same problem.

I am really looking for some 2 parts, first the HTML that belongs on the client, and secondly the Controller that would be on the REST Server to verify with google. Even if this is in another language that I can convert, this will be useful!

I have a Single Page Application (SPA) I would like to add ReCaptcha to. This application is hosted using IIS as flat Html, Css & Javascript, this SPA in turn talks to a separate REST server (using CORS) for all dynamic content.

The REST server is written using ASP WebAPI. The problem is; all examples I have seen of ReCaptcha all use ASP MVC (or other languages) to inject html into the webpage, I cannot modify the webpage using ASP in this manor. Hopefully someone else has had the same problem.

I am really looking for some 2 parts, first the HTML that belongs on the client, and secondly the Controller that would be on the REST Server to verify with google. Even if this is in another language that I can convert, this will be useful!

Share Improve this question asked May 22, 2014 at 4:32 Josh McJosh Mc 10.3k8 gold badges56 silver badges68 bronze badges 1
  • Ofcourse after hours of searching, 10 mins after I submit I find something that may work. Checking out codeproject./Articles/116250/Custom-reCaptcha-Validation. Will post if this works. – Josh Mc Commented May 22, 2014 at 4:39
Add a ment  | 

2 Answers 2

Reset to default 3

Looks like what I wanted was simply to use reCaptcha without plugins (https://developers.google./recaptcha/docs/display)

I have used ngx-captcha with my angular project. Here's how I kept my submit button disabled until recaptcha checkbox is checked.

   //code
 <ngx-recaptcha2 (success)="handleSuccess($event)"   #captchaElem [siteKey]="siteKey" formControlName="recaptcha">
                </ngx-recaptcha2>

once captcha is filled , it emits a success event , so use it in a method to make a variable true/false based on which you can enable/disable submit button

发布评论

评论列表(0)

  1. 暂无评论