Remove duplicate call to randomof and setting characters

Remove debug
ref #469
indiachan-spamvector
Thomas Lynch 2 years ago
parent c969814f54
commit f0ae0691a4
Signed by: fatchan
GPG Key ID: 112884AA57DF40B1
  1. 4
      lib/captcha/generators/grid2.js

@ -58,10 +58,8 @@ module.exports = async () => {
const isCorrect = await randomBool(127);
if (col < correctCol) {
arrows = isCorrect ? eArrows : [...sArrows, ...nArrows, ...wArrows];
charMatrix[correctRow][col] = await randomOf(arrows);
} else if (col > correctCol) {
arrows = isCorrect ? wArrows : [...sArrows, ...nArrows, ...eArrows];
charMatrix[correctRow][col] = await randomOf(arrows);
}
charMatrix[correctRow][col] = await randomOf(arrows);
answerMatrix[correctRow][col] = isCorrect;
@ -112,8 +110,6 @@ module.exports = async () => {
}
}
//console.log(charMatrix, answerMatrix);
//insert the captcha to db and get id
const captchaId = await Captchas.insertOne(answerMatrix.flat()).then(r => r.insertedId);

Loading…
Cancel
Save