Node.js module for hiding email addresses from bots with reCAPTCHA Mailhide API through an Express view helper.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
Readme.md
index.js
package.json

Readme.md

node-recaptcha-mailhide

Node.js module for hiding email addresses from bots with reCAPTCHA Mailhide API through an Express view helper.

reCAPTCHA Mailhide

Usage

  1. Install the module for your respective project npm install recaptcha-mailhide.
  2. Generate a public and private key for your project at http://www.google.com/recaptcha/mailhide/apikey.
  3. Require the module and add it as a dynamic view helper utilizing the Server Example below.
  4. Use it in your views utilizing your respective template engine's View Example below.

Server Example

var express = require('express');

var config = {
  public: 'YOUR-PUBLIC-KEY',
  private: 'YOUR-PRIVATE-KEY'
};

var app = express.createServer();

// ...

app.dynamicHelpers({
  recaptchaMailhide: require('recaptcha-mailhide')(config)
});

// ...

app.listen(3000);

View Example

NOTE: recaptchaMailhide accepts two arguments email and name (name is optional and defaults to email).

Jade

!= recaptchaMailhide('niftylettuce@gmail.com', 'niftylettuce')

Outputs:

<a href="http://www.google.com/recaptcha/mailhide/d?k=YOUR-PUBLIC-KEY&c=AES-ENCRYPTED-EMAIL" onclick="window.open('http://www.google.com/recaptcha/mailhide/d?k=YOUR-PUBLIC-KEY&c=AES-ENCRYPTED-EMAIL', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">niftylettuce</a>

EJS

<%- recaptchaMailhide('niftylettuce@gmail.com') %>

Outputs:

nift<a href="http://www.google.com/recaptcha/mailhide/d?k=YOUR-PUBLIC-KEY&c=AES-ENCRYPTED-EMAIL" onclick="window.open('http://www.google.com/recaptcha/mailhide/d?k=YOUR-PUBLIC-KEY&c=AES-ENCRYPTED-EMAIL', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@gmail.com

Contributors

License

MIT Licensed