Install Fields, APIs and pages (coming soon) using the public repository.
Nodemill API: captcha
nodemill install api captcha
- Author: Paul Burrowes
- Short desc: Create a captcha and save the code to the req.session.captcha
- Keywords: captcha,image
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.
- 1.0.0 Created