Nodemill Addins


Install Fields, APIs and pages (coming soon) using the public repository.

Search:
Within:

Nodemill API: captcha

Nodemill Version Nodemill Downloads

Install

nodemill install api captcha

Details

  • Author: Paul Burrowes
  • Short desc: Create a captcha and save the code to the req.session.captcha
  • Keywords: captcha,image

Full Description

Generate a captcha as an API. So, in your template file declare a html image with:

<img src="api/captcha">
<input class="form-control" name="captcha" placeholder="code" required/>

Then when the api is called it will generate a 4-digit captcha, save the code to req.session.captcha and return the image as a 72x40 image.

In your page controller, when you need to check the code that the user entered:

var goodCode = (req.session.captcha == req.body.captcha);

and you can take it from there.

Version history

  • 1.0.0 Created

Examples

/api/captcha/