allow grid captcha yIconOffset=0

indiachan-spamvector
Thomas Lynch 2 years ago
parent b57a69f8d6
commit b1751f1706
  1. 4
      lib/captcha/generators/grid.js

@ -9,7 +9,7 @@ const gm = require('@fatchan/gm').subClass({ imageMagick: true })
module.exports = async (captchaOptions) => {
const { size, trues, falses, imageSize, noise, edge } = captchaOptions.grid;
const { size, trues, falses, imageSize, noise, edge, iconYOffset } = captchaOptions.grid;
const width = imageSize+padding; //TODO: these will never be different, right?
const height = imageSize+padding;
@ -37,7 +37,7 @@ module.exports = async (captchaOptions) => {
for(let i = 0; i < size; i++) { //for character in row
const index = (j*size)+i;
const cyOffset = await randomRange(0, captchaOptions.grid.iconYOffset);
const cyOffset = iconYOffset > 0 ? (await randomRange(0, iconYOffset)) : 0;
let character;
if (boolArray[index] === true) {
character = trues[(await randomRange(0, trues.length))];

Loading…
Cancel
Save