1.1.4 • Published 4 years ago

egg-trek-captcha v1.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

egg-trek-captcha

A captcha plugin based on trek-captcha.

Install

npm i egg-trek-captcha --save

Usage

// {app_root}/config/plugin.js
exports.trekCaptcha = {
  enable: true,
  package: 'egg-trek-captcha',
};

Configuration

// {app_root}/config/config.default.js
exports.trekCaptcha = {
  // trek-captcha options
  size: 4,
  style: -1
  // redis related function (need egg-redis)
  redis: false,
  // captcha expires
  expires: 3000,
};

If you enable the redis related function, you can use "app.catpcha.verfiy" to verify your code.

Request should have an UUID and verify your code like this:

const res = await app.captcha.verify(uuid, code);
console.log(res);
/**
 * res: {
 *   success: true, // or false
 *   reason: '', // if failed, here's the reason
 * }
*/

License

MIT

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago