All Projects → Enngage → Ngx Captcha

Enngage / Ngx Captcha

Licence: mit
ReCaptcha components for Angular. Live preview:

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Captcha

Recaptcha Spring Boot Starter
Spring Boot starter for Google's reCAPTCHA
Stars: ✭ 103 (-10.43%)
Mutual labels:  captcha, recaptcha
Hooman
http interceptor to hoomanize cloudflare requests
Stars: ✭ 82 (-28.7%)
Mutual labels:  captcha, recaptcha
2captcha-python
Python 3 package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
Stars: ✭ 140 (+21.74%)
Mutual labels:  recaptcha, captcha
Captcha-Tools
All-in-one Python (And now Go!) module to help solve captchas with Capmonster, 2captcha and Anticaptcha API's!
Stars: ✭ 23 (-80%)
Mutual labels:  recaptcha, captcha
Recaptcha
reCAPTCHA = REcognize CAPTCHA: A Burp Suite Extender that recognize CAPTCHA and use for intruder payload 自动识别图形验证码并用于burp intruder爆破模块的插件
Stars: ✭ 596 (+418.26%)
Mutual labels:  captcha, recaptcha
2captcha-go
Golang Module for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
Stars: ✭ 31 (-73.04%)
Mutual labels:  recaptcha, captcha
recaptcha
An easy-to-use reCAPTCHA package
Stars: ✭ 55 (-52.17%)
Mutual labels:  recaptcha, captcha
CapMonsterCloud
a C# wrapper for CapMonster Cloud API
Stars: ✭ 17 (-85.22%)
Mutual labels:  recaptcha, captcha
Angular Recaptcha
AngularJS directive to add a reCaptcha widget to your form
Stars: ✭ 502 (+336.52%)
Mutual labels:  captcha, recaptcha
Buster
Captcha solver extension for humans
Stars: ✭ 4,244 (+3590.43%)
Mutual labels:  captcha, recaptcha
opensea automatic uploader
(Bypass reCAPTCHAs) A Selenium Python bot to automatically and bulky upload and list your NFTs on OpenSea (all metadata integrated - Ethereum and Polygon supported); reCAPTCHA solver & bypasser included.
Stars: ✭ 205 (+78.26%)
Mutual labels:  recaptcha, captcha
Beelabrecaptcha2bundle
💻 Symfony bundle for Google Recaptcha2
Stars: ✭ 47 (-59.13%)
Mutual labels:  captcha, recaptcha
captcha-solver
Library and CLI for automating captcha verification across multiple providers.
Stars: ✭ 101 (-12.17%)
Mutual labels:  recaptcha, captcha
wagtail-django-recaptcha
A simple recaptcha field for Wagtail Form Pages
Stars: ✭ 47 (-59.13%)
Mutual labels:  recaptcha, captcha
Server-Captcha
Protect Your Server From Automated Bots With Captcha Now !
Stars: ✭ 18 (-84.35%)
Mutual labels:  recaptcha, captcha
2captcha-php
PHP package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
Stars: ✭ 25 (-78.26%)
Mutual labels:  recaptcha, captcha
simple-recaptcha-v3
🤖 This repository contains simple reCAPTCHA v3 integration for your Laravel application.
Stars: ✭ 25 (-78.26%)
Mutual labels:  recaptcha, captcha
wp-recaptcha-integration
WordPress reCaptcha integration supporting Ninja Forms and Contact Form 7
Stars: ✭ 50 (-56.52%)
Mutual labels:  recaptcha, captcha
recaptcha-2-phpbbmod
reCAPTCHA v2 for phpBB Olympus 3.0
Stars: ✭ 14 (-87.83%)
Mutual labels:  recaptcha, captcha
Rucaptcha
Captcha gem for Rails Application. No dependencies. No ImageMagick, No RMagick.
Stars: ✭ 607 (+427.83%)
Mutual labels:  captcha, recaptcha

npm version Build Status NPM

Angular Captcha

Google reCaptcha implementation for Angular 6 and beyond.

Features:

  1. reCaptcha v2
  2. reCaptcha v3 (beta)
  3. invisible reCaptcha

Live examples: https://enngage.github.io/ngx-captcha/

Installation

npm install ngx-captcha

Import NgxCaptchaModule to your module (i.e. AppModule)

Use with Angular forms

Depending on whether you want to use reactive forms or template-driven forms you need to include the appropriate modules, too. Add ReactiveFormsModule to your imports in case you want to use reactive forms. If you prefer the the template-driven approach simple add the FormsModule to your module.

Both can be imported from @angular/forms. In the demo project you can check out the normal demo to see how to use reactive forms or the invisible demo to see what the template-driven approach looks like. With the template-driven approach you don't necessarily need to use a from element to wrap the component, you can instead use the [ngModelOptions]="{ standalone: true }". However, using it with the standalone option is not recommended but can be used if needed.

import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { NgxCaptchaModule } from 'ngx-captcha';

@NgModule({
  imports: [
    ReactiveFormsModule,
    NgxCaptchaModule
  })

export class AppModule { }

Usage

The configuration properties are a copy of the official ones that google provides. For explanation of what these properties do and how to use them, please refer to https://developers.google.com/recaptcha/docs/display and https://developers.google.com/recaptcha/docs/invisible.

reCaptcha v2

your.component.ts

export class YourComponent implements OnInit {
  protected aFormGroup: FormGroup;

  constructor(private formBuilder: FormBuilder) {}

  ngOnInit() {
    this.aFormGroup = this.formBuilder.group({
      recaptcha: ['', Validators.required]
    });
  }
}

your.template.html

<form [formGroup]="aFormGroup">
  <ngx-recaptcha2 #captchaElem
    [siteKey]="siteKey"
    (reset)="handleReset()"
    (expire)="handleExpire()"
    (load)="handleLoad()"
    (success)="handleSuccess($event)"
    [useGlobalDomain]="false"
    [size]="size"
    [hl]="lang"
    [theme]="theme"
    [type]="type"
    formControlName="recaptcha">
  </ngx-recaptcha2>
</form>

reCaptcha v3

This is the implementation of beta version of google reCaptcha v3 as per following documentation"https://developers.google.com/recaptcha/docs/v3".

First you need to inject the class in your component / service and then use Execute method with your action. Once you have the token, you need to verify it on your backend to get meaningful results. See official google documentation for more details.

import { ReCaptchaV3Service } from 'ngx-captcha';

 constructor(
   private reCaptchaV3Service: ReCaptchaV3Service
 ) { }

 ....

 this.reCaptchaV3Service.execute(this.siteKey, 'homepage', (token) => {
   console.log('This is your token: ', token);
 }, {
     useGlobalDomain: false
 });

Invisible reCaptcha

<form [formGroup]="aFormGroup">
  <ngx-invisible-recaptcha #captchaElem
    [siteKey]="siteKey"
    (reset)="handleReset()"
    (ready)="handleReady()"
    (load)="handleLoad()"
    (success)="handleSuccess($event)"
    [useGlobalDomain]="false"
    [type]="type"
    [badge]="badge"
    [ngModel]="recaptcha"
    [ngModelOptions]="{ standalone: true }">
  </ngx-invisible-recaptcha>
</form>

Unit testing

Unit testing in Angular is possible, but a bit clunky because this component tries to dynamically include google's script if its not already loaded. You are not required to include in globally or manually which has a benefit of not loading until you actually use this component. This has a caveat though, since the load callback is executed outside of Angular's zone, performing unit tests might fail due to racing condition where Angular might fail the test before the script has a chance to load and initialize captcha.

A simple fix for this is wait certain amount of time so that everything has a chance to initialize. See example below:

beforeEach(() => {
        fixture = TestBed.createComponent(YourComponent);
        component = fixture.componentInstance;
        setTimeout(function () {
            fixture.detectChanges();
        }, 2000);
});

Other possible scenario might be including google's script globally. If someone has a better solution, please do let me know or submit a PR for a change in readme.

Publishing lib

Under projects\ngx-captcha-lib run

npm run publish-lib

Publishing demo app

Under root, generate demo app with

npm run build-demo-gh-pages
npx ngh --dir=dist-demo
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].