# express-captcha

> Simple captcha middleware for express based upon node-captcha

Latest version **1.0.0** (published 2016-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install express-captcha
pnpm add express-captcha
yarn add express-captcha
bun add express-captcha
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-01-22 |
| First published | 2016-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 5.1.x |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | diwyanshu |
| Maintainers | diwyanshu |

## Links

- npm: https://www.npmjs.com/package/express-captcha
- Repository: https://github.com/diwyanshu/simple-node-captcha
- Homepage: https://github.com/diwyanshu/simple-node-captcha#readme
- Issues: https://github.com/diwyanshu/simple-node-captcha/issues
- npm.io page: https://npm.io/package/express-captcha

## Dependencies (1)

- [canvas](https://npm.io/package/canvas.md) 1.0.4

## Recent versions

- 1.0.0 (latest) — 2016-01-22

## README

# Captcha

Simple captcha for Connect/Express.

## Installation

Via npm:

	$ npm install express-captcha

## Usage (for Express 3)

```javascript
var express = require('express');
var captcha = require('express-captcha');

var app = express();

app.configure(function(){
    app.use(express.bodyParser());
	app.use(express.cookieParser());
	app.use(cookieSession({ secret: 'secretkeyhere' }));
	app.use(captcha({ url: '/captcha.jpg', color:'#000', background: '#f6f6f6' })); // captcha params
});

app.get('/', function(req, res){
	res.type('html');
	res.end('<img src="/captcha.jpg"/><form action="/login" method="post"><input type="text" name="digits"/></form>'); // captcha render
});

app.post('/login', function(req, res){
	res.type('html');
	res.end('CONFIRM: ' + (req.body.digits == req.session.captcha)); // captcha verify
});

app.listen(8000);
console.log('Web server started.');
```

## Full list of parameters
```javascript
    var params={
       "url":"/captcha.jpg",
       "color":"#ffffff",// can be omitted, default 'rgb(0,100,100)'
       "background":"#000000",// can be omitted, default 'rgb(255,200,150)'
       "lineWidth" : 2, // can be omitted, default 8
       "fontSize" : 40, // can be omitted, default 80
       "codeLength" : 6, // length of code, can be omitted, default 6
       "canvasWidth" : 150,// can be omitted, default 250
       "canvasHeight" : 100,// can be omitted, default 150
    }
    app.use(captcha(params)); // captcha params
```

---
_Source: https://npm.io/package/express-captcha · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
