egg-captcha
captcha plugin for egg framework, based on ccap
Install
$ npm i egg-captcha --save
Usage
// {app_root}/config/plugin.js exportscaptcha = enable: true package: 'egg-captcha';
Configuration
// {app_root}/config/config.default.js exportscaptcha = width: 256 // set width,default is 256 height: 60 // set height,default is 60 offset: 40 // set text spacing,default is 40 quality: 100 // set pic quality,default is 50 fontsize: 57 // set font size,default is 57
see config/config.default.js for more detail.
Example
// {app_root}/controller/user.js async { const ctx service = this const captcha txt = await serviceuser ctxbody = captcha ctxtype = 'image/png' // need open the egg-session plugin ctxsessioncaptcha = txt}
// {app_root}/service/user.js async { const app = this const ary = appcaptcha return captcha: ary1 txt: ary0}
Questions & Suggestions
Please open an issue here.