fix 邮件验证码过滤条件
This commit is contained in:
parent
6782b93e33
commit
702e31e543
|
|
@ -1003,6 +1003,16 @@ export async function bindByMobile(params, context) {
|
|||
throw new OakUserException('验证码已经过期');
|
||||
}
|
||||
// 到这里说明验证码已经通过
|
||||
await context.operate('captcha', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
data: {
|
||||
expired: true
|
||||
},
|
||||
filter: {
|
||||
id: captchaRow.id
|
||||
}
|
||||
}, {});
|
||||
// 检查当前user是否已绑定mobile
|
||||
const [boundMobile] = await context.select('mobile', {
|
||||
data: {
|
||||
|
|
@ -1945,6 +1955,7 @@ export async function sendCaptchaByMobile({ mobile, env, type: captchaType, }, c
|
|||
const [count1, count2] = await Promise.all([
|
||||
context.count('captcha', {
|
||||
filter: {
|
||||
origin: 'mobile',
|
||||
visitorId,
|
||||
$$createAt$$: {
|
||||
$gt: now - 3600 * 1000,
|
||||
|
|
@ -2093,6 +2104,7 @@ export async function sendCaptchaByEmail({ email, env, type: captchaType, }, con
|
|||
const [count1, count2] = await Promise.all([
|
||||
context.count('captcha', {
|
||||
filter: {
|
||||
origin: 'email',
|
||||
visitorId,
|
||||
$$createAt$$: {
|
||||
$gt: now - 3600 * 1000,
|
||||
|
|
|
|||
|
|
@ -1011,6 +1011,16 @@ async function bindByMobile(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
|
||||
}
|
||||
}, {});
|
||||
// 检查当前user是否已绑定mobile
|
||||
const [boundMobile] = await context.select('mobile', {
|
||||
data: {
|
||||
|
|
@ -1961,6 +1971,7 @@ async function sendCaptchaByMobile({ mobile, env, type: captchaType, }, context)
|
|||
const [count1, count2] = await Promise.all([
|
||||
context.count('captcha', {
|
||||
filter: {
|
||||
origin: 'mobile',
|
||||
visitorId,
|
||||
$$createAt$$: {
|
||||
$gt: now - 3600 * 1000,
|
||||
|
|
@ -2110,6 +2121,7 @@ async function sendCaptchaByEmail({ email, env, type: captchaType, }, context) {
|
|||
const [count1, count2] = await Promise.all([
|
||||
context.count('captcha', {
|
||||
filter: {
|
||||
origin: 'email',
|
||||
visitorId,
|
||||
$$createAt$$: {
|
||||
$gt: now - 3600 * 1000,
|
||||
|
|
|
|||
|
|
@ -1291,8 +1291,22 @@ export async function bindByMobile<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!
|
||||
}
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
// 检查当前user是否已绑定mobile
|
||||
const [boundMobile] = await context.select(
|
||||
'mobile',
|
||||
|
|
@ -1311,6 +1325,7 @@ export async function bindByMobile<ED extends EntityDict>(
|
|||
forUpdate: true,
|
||||
}
|
||||
)
|
||||
|
||||
if (boundMobile) {
|
||||
//用户已绑定的mobile与当前输入的mobile一致
|
||||
if (boundMobile.mobile === mobile) {
|
||||
|
|
@ -2619,6 +2634,7 @@ export async function sendCaptchaByMobile<ED extends EntityDict>(
|
|||
'captcha',
|
||||
{
|
||||
filter: {
|
||||
origin: 'mobile',
|
||||
visitorId,
|
||||
$$createAt$$: {
|
||||
$gt: now - 3600 * 1000,
|
||||
|
|
@ -2804,6 +2820,7 @@ export async function sendCaptchaByEmail<ED extends EntityDict>(
|
|||
'captcha',
|
||||
{
|
||||
filter: {
|
||||
origin: 'email',
|
||||
visitorId,
|
||||
$$createAt$$: {
|
||||
$gt: now - 3600 * 1000,
|
||||
|
|
|
|||
Loading…
Reference in New Issue