验证码登录成功就失效

This commit is contained in:
wkj 2025-06-30 19:22:41 +08:00
parent 641ffd4b1f
commit faee5e9f3a
3 changed files with 34 additions and 0 deletions

View File

@ -470,6 +470,16 @@ export async function loginByMobile(params, context) {
throw new OakUserException('验证码已经过期');
}
// 到这里说明验证码已经通过
await context.operate('captcha', {
id: await generateNewIdAsync(),
action: 'update',
data: {
expired: true
},
filter: {
id: captchaRow.id
}
}, {});
return await setupMobile(mobile, env, context);
}
else {

View File

@ -474,6 +474,16 @@ async function loginByMobile(params, context) {
throw new types_1.OakUserException('验证码已经过期');
}
// 到这里说明验证码已经通过
await context.operate('captcha', {
id: await (0, uuid_1.generateNewIdAsync)(),
action: 'update',
data: {
expired: true
},
filter: {
id: captchaRow.id
}
}, {});
return await setupMobile(mobile, env, context);
}
else {

View File

@ -642,6 +642,20 @@ export async function loginByMobile<ED extends EntityDict>(
if (captchaRow.expired) {
throw new OakUserException('验证码已经过期');
}
await context.operate(
'captcha',
{
id: await generateNewIdAsync(),
action: 'update',
data: {
expired: true
},
filter: {
id: captchaRow.id!
}
},
{}
);
// 到这里说明验证码已经通过
return await setupMobile<ED>(mobile, env, context);