Authored by htoooth

fix capthca

... ... @@ -87,11 +87,9 @@ const generateQiniu = (req, res, next) => {
req.session.captcha = result.data.text;
req.session.captchaCount = 0;
let imageUrl = result.data.images + `/watermark/2/text/${uuid.v4()}/fontsize/120/dissolve/10`;
res.type('png');
if (result.code === 200) {
request(imageUrl).pipe(res);
request(result.data.images).pipe(res);
}
}).catch(next);
... ...
... ... @@ -5,6 +5,7 @@
'use strict';
const api = require('./captcha-api');
const uuid = require('uuid');
exports.generateCaptcha = () => {
return api.gen().then((result) => {
... ... @@ -17,7 +18,8 @@ exports.generateCaptcha = () => {
code: 200,
data: {
text: codeStr,
images: `${result.data.verifiedGraphicCode}?imageView/2/w/240`
images: `${result.data.verifiedGraphicCode}` +
`?imageView/2/w/240/watermark/2/text/${uuid.v4()}/fontsize/120/dissolve/10`
}
};
} else {
... ...