JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 80
  • Score
    100M100P100Q65587F

BotDetect Captcha AngularJS Module (JavaScript: Angular 1.x)

Package Exports

  • angularjs-captcha

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (angularjs-captcha) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

BotDetect Captcha AngularJS Module (JavaScript: Angular 1.x)

Quick guide:

1) Captcha AngularJS Module Installation
npm install angularjs-captcha --save
2) Include Captcha AngularJS Module in Your Web App
<script src="node_modules/angularjs-captcha/dist/angularjs-captcha.min.js"></script>
3) Add Captcha AngularJS Module to Your AngularJS Module
  • Java Captcha endpoint:
var app = angular.module('app', ['BotDetectCaptcha']);

app.config(function(captchaSettingsProvider) {
  ...
  
  captchaSettingsProvider.setSettings({
    captchaEndpoint: '/botdetect-java-captcha-api-path-at-server-side/botdetectcaptcha'
  });
});
  • PHP Captcha endpoint:
var app = angular.module('app', ['BotDetectCaptcha']);

app.config(function(captchaSettingsProvider) {
  ...
  
  captchaSettingsProvider.setSettings({
    captchaEndpoint: '/botdetect-php-captcha-api-path-at-server-side/simple-botdetect.php'
  });
});
4) Display Captcha In AngularJS Template
<botdetect-captcha styleName="exampleCaptcha"></botdetect-captcha>
5) Validate Captcha on the Client-side
<input 
  type="text" 
  id="captchaCode"
  name="captchaCode"
  ng-model="captchaCode" 
  correct-captcha
>
6) Validate Captcha on the Server-side

The client-side Captcha validation is just a usability improvement. Captcha protects some action on a server-side, and therefore Captcha validation has to be there as well.

  • Server-side Captcha validation with Java Captcha looks in this way:
SimpleCaptcha captcha = SimpleCaptcha.load(request);
boolean isHuman = captcha.validate(captchaCode, captchaId);
  • Server-side Captcha validation with PHP Captcha looks in this way:
$captcha = new SimpleCaptcha();
$isHuman = $captcha->Validate($captchaCode, $captchaId);

Docs:

AngularJS CAPTCHA Integration Guide

Code Examples:

  1. Basic AngularJS CAPTCHA Example

  2. AngularJS CAPTCHA Form Example

Dependencies:

Captcha AngularJS module uses Captcha library for Captcha image and Captcha sound generation. At the moment challenges are generated in Java backend with BotDetect Java Captcha library and BotDetect PHP Captcha library, but BotDetect ASP.NET is going to work with Captcha AngularJS module soon as well.

Technical Support:

Through contact form on captcha.com.