recaptcha-middleware
reCAPTCHA verify middleware
Last updated 5 years ago by confuser .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install recaptcha-middleware 
SYNC missed versions from official npm registry.

recaptcha-middleware

Build Status Coverage Status

Installation

npm install recaptcha-middleware --save

Usage


var app = require('express')()
  , middleware = require('recaptcha-middleware')({ secretKey: 'secretKey' })

app.get('/hello', middleware, function (req, res, next) {
  next()
})

app.post('/hello', middleware, function (req, res, next) {
  next()
})

Requires either a body field g-recaptcha-response or query string parameter of the same name to support multiple HTTP verbs

Override error messages

var opts =
  { secretKey: 'secretKey'
  , errors:
    { validation: function () { return new Error('Missing g-recaptcha-response field') }
    , missingBody: function () { return new Error('Missing body response from recaptcha') }
    , missingError: function () { return new Error('Recaptcha not successful but no error codes provided') }
    , recaptchaErrorHandler: function (errors) {
        return new Error(errors.join(', '))
      }
    }
  }
  , middleware = require('recaptcha-middleware')(opts)

Current Tags

  • 2.0.0                                ...           latest (5 years ago)

3 Versions

  • 2.0.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |