|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
const { Captchas, Ratelimits } = require(__dirname+'/../../db/') |
|
|
|
const { Captchas, Ratelimits } = require(__dirname+'/../../db/') |
|
|
|
, generateCaptcha = require(__dirname+'/../../helpers/captcha/captchagenerate.js') |
|
|
|
, generateCaptcha = require(__dirname+'/../../helpers/captcha/captchagenerate.js') |
|
|
|
|
|
|
|
, { secureCookies } = require(__dirname+'/../../configs/main.json') |
|
|
|
, production = process.env.NODE_ENV === 'production'; |
|
|
|
, production = process.env.NODE_ENV === 'production'; |
|
|
|
|
|
|
|
|
|
|
|
module.exports = async (req, res, next) => { |
|
|
|
module.exports = async (req, res, next) => { |
|
|
@ -26,7 +27,7 @@ module.exports = async (req, res, next) => { |
|
|
|
return res |
|
|
|
return res |
|
|
|
.cookie('captchaid', captchaId.toString(), { |
|
|
|
.cookie('captchaid', captchaId.toString(), { |
|
|
|
'maxAge': 5*60*1000, //5 minute cookie
|
|
|
|
'maxAge': 5*60*1000, //5 minute cookie
|
|
|
|
'secure': production, |
|
|
|
'secure': production && secureCookies, |
|
|
|
'sameSite': 'strict' |
|
|
|
'sameSite': 'strict' |
|
|
|
}) |
|
|
|
}) |
|
|
|
.redirect(`/captcha/${captchaId}.jpg`); |
|
|
|
.redirect(`/captcha/${captchaId}.jpg`); |
|
|
|