We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
controller 里面存储 // 获取验证码 async getCaptcha(){ const {ctx} = this; var captcha = ctx.service.user.getCaptcha(); ctx.session.code = captcha.text; // session 存储 console.log('session 存储',ctx.session.code) ctx.body = captcha.data; }
service里面打印ctx.session.code 为 undefined,为什么?????? // 检查验证码是否正确 checkCaptcha(code){ const {ctx} = this; code = code.toLowerCase() console.log("sessionCode",ctx.session.code) // undefined??????? let sessCode = ctx.session.code? ctx.session.code.toLowerCase():null console.log("sesscode",sessCode) //验证 if(code === sessCode){ // 成功之后验证码作废 ctx.session.code = null } return code === sessCode; }
The text was updated successfully, but these errors were encountered:
Hello @ChunrunHan. Please provide a reproducible example following the instruction.
Issues labeled by Need Reproduce will be closed if no activities in 7 days.
Need Reproduce
@ChunrunHan,请根据这个说明提供最小可复现代码。
如果在 7 天内没有进展会被自动关闭。
Sorry, something went wrong.
No branches or pull requests
controller 里面存储
// 获取验证码
async getCaptcha(){
const {ctx} = this;
var captcha = ctx.service.user.getCaptcha();
ctx.session.code = captcha.text; // session 存储
console.log('session 存储',ctx.session.code)
ctx.body = captcha.data;
}
service里面打印ctx.session.code 为 undefined,为什么??????
// 检查验证码是否正确
checkCaptcha(code){
const {ctx} = this;
code = code.toLowerCase()
console.log("sessionCode",ctx.session.code) // undefined???????
let sessCode = ctx.session.code? ctx.session.code.toLowerCase():null
console.log("sesscode",sessCode)
//验证
if(code === sessCode){
// 成功之后验证码作废
ctx.session.code = null
}
return code === sessCode;
}
The text was updated successfully, but these errors were encountered: