Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crcaptcha

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crcaptcha

Show and check the Civil Rights Captcha

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

node-crcaptcha

Renders and checks the Civil Rights Captcha.

Installation

$ npm install crcaptcha

Library

crcaptcha.show(callback(err, captchaHtml), lang = en)

Requests a captcha form. The two languages currently supported are Swedish (sv) and English (en.)


crcaptcha.check(code, sessid, callback(err, success))

Verify a captcha.

Example using Express

app.js:

var express = require("express")
    , http = require("http")
    , crc = require("../lib/crcaptcha");

var app = express();

app.configure(function(){
    app.set("port", process.env.PORT || 3000);
    app.set("views", __dirname + "/views");
    app.set("view engine", "jade");
    app.use(express.favicon());
    app.use(express.logger("dev"));
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(app.router);
});

app.configure("development", function(){
    app.use(express.errorHandler());
});

app.get("/", function(req, res) {
    crc.show(function (err, html) {
        if (err) {
            console.log(err);
        } else {
            res.render("form", { captcha: html });
        }
    });
});

app.post("/", function (req, res) {
    crc.check(req.body.crc_captcha, req.body.crc_sessid, function (err, success) {
        if (err) {
            console.log(err);
        } else {
            if (success) {
                res.send("Right.");
            } else {
                res.send("Wrong.");
            }
        }
    });
});

http.createServer(app).listen(app.get("port"), function(){
    console.log("Express server listening on port " + app.get("port"));
});

views/form.jade:

!!! 5
html
  head
    script(src="http://code.jquery.com/jquery-latest.min.js", type="text/javascript")
  body
    form(method='POST', action='/')
      != captcha
      input(type='submit', value='Check Civil Rights Captcha')

Keywords

FAQs

Package last updated on 12 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc