0.0.4 • Published 8 years ago

node-math-captcha v0.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

node-math-captcha

A math captcha for node

Install

  • GraphicsMagicks (OS package) is needed
  • npm install node-math-captcha

Usage

require('node-math-captcha').generate(bgFile, fontFile, outputDir, numOps, callback)

  • bgFile - a relative path (from your app's point) with filename for desired background image
  • fontFile - a relative path (from your app's entry point) with filename for desired font
  • outputDir - a relative path (from your app's entry point)
  • numOps - number of operations in the captcha challenge
  • callback - is called as callback(err, imageName, answerStr)

An easy method is to use express sessions to store the captcha answer. Have your frontend signup page request a captcha via a route that calls the generate function. Then your backend signup script can compare user input to the captcha answer stored in the express session. Of course, on failed attempts (and successes) you want to invalidate the captcha (e.g. set answer to equal null).

Sample Screenshot

Screenshot

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago