recaptcha

WebJar for recaptcha

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

recaptcha
Последняя версия

Последняя версия

1.2.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

recaptcha
WebJar for recaptcha
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/mirhampt/node-recaptcha

Скачать recaptcha

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/recaptcha/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>recaptcha</artifactId>
    <version>1.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/recaptcha/
implementation 'org.webjars.npm:recaptcha:1.2.1'
// https://jarcasting.com/artifacts/org.webjars.npm/recaptcha/
implementation ("org.webjars.npm:recaptcha:1.2.1")
'org.webjars.npm:recaptcha:jar:1.2.1'
<dependency org="org.webjars.npm" name="recaptcha" rev="1.2.1">
  <artifact name="recaptcha" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='recaptcha', version='1.2.1')
)
libraryDependencies += "org.webjars.npm" % "recaptcha" % "1.2.1"
[org.webjars.npm/recaptcha "1.2.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

node-recaptcha

node-recaptcha renders and verifies Recaptcha captchas.

NOTE: This release currently only supports Recaptcha version 1.

Installation

Via git:

$ git clone git://github.com/mirhampt/node-recaptcha.git ~/.node_libraries/node-recaptcha

Via npm:

$ npm install recaptcha

Setup

Before you can use this module, you must visit http://www.google.com/recaptcha to request a public and private API key for your domain.

Running the Tests

To run the tests for this module, you will first need to install nodeunit. Then, simply run:

$ nodeunit test.js

Customizing the Recaptcha

See these instructions for help customizing the look of Recaptcha. In brief, you will need to add a structure like the following before the form in your document:

<script type="text/javascript">
    var RecaptchaOptions = {
       theme : 'clean',
       lang  : 'en'
    };
</script>

Example Using Express

app.js:

var express  = require('express'),
    Recaptcha = require('recaptcha').Recaptcha;

var PUBLIC_KEY  = 'YOUR_PUBLIC_KEY',
    PRIVATE_KEY = 'YOUR_PRIVATE_KEY';

var app = express.createServer();

app.configure(function() {
    app.use(express.bodyParser());
});

app.get('/', function(req, res) {
    var recaptcha = new Recaptcha(PUBLIC_KEY, PRIVATE_KEY);

    res.render('form.jade', {
        layout: false,
        locals: {
            recaptcha_form: recaptcha.toHTML()
        }
    });
});

app.post('/', function(req, res) {
    var data = {
        remoteip:  req.connection.remoteAddress,
        challenge: req.body.recaptcha_challenge_field,
        response:  req.body.recaptcha_response_field
    };
    var recaptcha = new Recaptcha(PUBLIC_KEY, PRIVATE_KEY, data);

    recaptcha.verify(function(success, error_code) {
        if (success) {
            res.send('Recaptcha response valid.');
        }
        else {
            // Redisplay the form.
            res.render('form.jade', {
                layout: false,
                locals: {
                    recaptcha_form: recaptcha.toHTML()
                }
            });
        }
    });
});

app.listen(3000);

views/form.jade:

form(method='POST', action='.')
  != recaptcha_form

  input(type='submit', value='Check Recaptcha')

Make sure express and jade are installed, then:

$ node app.js

Версии библиотеки

Версия
1.2.1