imageCaptcha.js 393 B

12345678910111213141516
  1. const express = require('express')
  2. const router = express.Router()
  3. const imageCaptch = require('svg-captcha')
  4. router.get('/', async (req, res) => {
  5. const svgimg = imageCaptch.create({
  6. size: 4,
  7. ignoreChars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
  8. noise: 2,
  9. color: true
  10. })
  11. req.session.imgtext = svgimg.text
  12. res.send(svgimg.data)
  13. })
  14. module.exports = router