Socket
Socket
Sign inDemoInstall

kaptcha

Package Overview
Dependencies
14
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    kaptcha

simple 6 digit captcha image middleware for express, modified from captcha middleware.


Version published
Weekly downloads
5
increased by150%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

kaptcha

simple 6 digit captcha image middleware for express, modified from captcha middleware

Installation

Canvas is required, please follow canvas instruction to install canvase dependencies. Canvas Wiki

Once canvas is installed successfully, run npm command to install kaptcha.

npm install kaptcha

Usage

As middleware (express-session middleware is required):

var kaptcha = require('kaptcha');

app.get('/kaptcha.png', kaptcha({ 
  color: 'rgb(0, 0, 0)', 
  background: 'rgb(255, 255, 255)',
  width: 100, 
  height: 30 
}))

app.post('/authenticate', function(req, res) {
  console.log(req.session.captcha == req.body.captcha);
})

Customize:

var kaptcha = require('kaptcha');

app.get('/captcha', function(req, res) {
  var code = kaptcha.generateCode();
  kaptcha.generateImage(req, res, { width: 100, height: 30, text: code });
})

Parameters

color

font color

background

background color

width

image width

height

image height

text

Optional captcha random code for generateImage(), and will be ignored in kaptcha middleware function.

Keywords

FAQs

Last updated on 11 Oct 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc