验证码区分mobile与email
This commit is contained in:
parent
8ba03c64b5
commit
24ccac2059
|
|
@ -606,7 +606,8 @@ export async function loginByMobile<ED extends EntityDict>(
|
|||
expired: 1,
|
||||
},
|
||||
filter: {
|
||||
mobile,
|
||||
origin: 'mobile',
|
||||
content: mobile,
|
||||
code: captcha,
|
||||
},
|
||||
sorter: [
|
||||
|
|
@ -1574,7 +1575,8 @@ export async function sendCaptcha<ED extends EntityDict>(
|
|||
'captcha',
|
||||
{
|
||||
filter: {
|
||||
mobile,
|
||||
origin: 'mobile',
|
||||
content: mobile,
|
||||
$$createAt$$: {
|
||||
$gt: now - 3600 * 1000,
|
||||
},
|
||||
|
|
@ -1600,7 +1602,8 @@ export async function sendCaptcha<ED extends EntityDict>(
|
|||
$$createAt$$: 1,
|
||||
},
|
||||
filter: {
|
||||
mobile,
|
||||
origin: 'mobile',
|
||||
content: mobile,
|
||||
$$createAt$$: {
|
||||
$gt: now - duration * 60 * 1000,
|
||||
},
|
||||
|
|
@ -1657,7 +1660,8 @@ export async function sendCaptcha<ED extends EntityDict>(
|
|||
action: 'create',
|
||||
data: {
|
||||
id,
|
||||
mobile,
|
||||
origin: 'mobile',
|
||||
content: mobile,
|
||||
code,
|
||||
visitorId,
|
||||
env,
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ import dayjs from 'dayjs';
|
|||
import { BRC } from "../types/RuntimeCxt";
|
||||
|
||||
export async function mergeUser<ED extends EntityDict>(
|
||||
params: {
|
||||
from: string,
|
||||
params: {
|
||||
from: string,
|
||||
to: string,
|
||||
mergeMobile?: true,
|
||||
mergeEmail?: true,
|
||||
mergeWechatUser?: true,
|
||||
}, context: BRC<ED>, innerLogic?: boolean
|
||||
) {
|
||||
) {
|
||||
const { from, to, mergeMobile, mergeEmail, mergeWechatUser } = params;
|
||||
if (!innerLogic && !context.isRoot()) {
|
||||
throw new OakUserUnpermittedException('user', { id: 'merge', action: 'merge', data: {}, filter: { id: from }}, '不允许执行mergeUser操作');
|
||||
throw new OakUserUnpermittedException('user', { id: 'merge', action: 'merge', data: {}, filter: { id: from } }, '不允许执行mergeUser操作');
|
||||
}
|
||||
assert(from);
|
||||
assert(to);
|
||||
|
|
@ -91,7 +91,7 @@ export async function mergeUser<ED extends EntityDict>(
|
|||
],
|
||||
},
|
||||
}, {});
|
||||
|
||||
|
||||
if (mergeEmail) {
|
||||
await context.operate('email', {
|
||||
id: await generateNewIdAsync(),
|
||||
|
|
@ -228,19 +228,19 @@ export async function updateUserPassword<ED extends EntityDict>(params: { userId
|
|||
{
|
||||
filter: lastSuccessfulTemp
|
||||
? {
|
||||
userId,
|
||||
$$seq$$: {
|
||||
$gt: lastSuccessfulTemp.$$seq$$!,
|
||||
},
|
||||
result: 'fail',
|
||||
}
|
||||
userId,
|
||||
$$seq$$: {
|
||||
$gt: lastSuccessfulTemp.$$seq$$!,
|
||||
},
|
||||
result: 'fail',
|
||||
}
|
||||
: {
|
||||
userId,
|
||||
$$createAt$$: {
|
||||
$gt: dayjs().startOf('day').valueOf(),
|
||||
},
|
||||
result: 'fail',
|
||||
},
|
||||
userId,
|
||||
$$createAt$$: {
|
||||
$gt: dayjs().startOf('day').valueOf(),
|
||||
},
|
||||
result: 'fail',
|
||||
},
|
||||
},
|
||||
{
|
||||
dontCollect: true,
|
||||
|
|
@ -326,7 +326,8 @@ export async function updateUserPassword<ED extends EntityDict>(params: { userId
|
|||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
mobile,
|
||||
origin: 'mobile',
|
||||
content: mobile,
|
||||
code: captcha,
|
||||
expired: false,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ export async function unbindingWechat<ED extends EntityDict>(
|
|||
expired: 1,
|
||||
},
|
||||
filter: {
|
||||
mobile,
|
||||
origin: 'mobile',
|
||||
content: mobile,
|
||||
code: captcha,
|
||||
},
|
||||
sorter: [{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ import { ActionDef, Index } from 'oak-domain/lib/types';
|
|||
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
|
||||
|
||||
export interface Schema extends EntityShape {
|
||||
mobile: String<11>;
|
||||
origin: 'mobile' | 'email';
|
||||
content: String<32>;
|
||||
code: String<4>;
|
||||
visitorId: Text;
|
||||
reason?: Text;
|
||||
|
|
@ -36,7 +37,8 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|||
zh_CN: {
|
||||
name: '验证码',
|
||||
attr: {
|
||||
mobile: '手机号',
|
||||
origin: '源',
|
||||
content: '内容',
|
||||
code: '验证码',
|
||||
visitorId: '用户标识',
|
||||
reason: '失败原因',
|
||||
|
|
@ -71,7 +73,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|||
name: 'index_mobile_code',
|
||||
attributes: [
|
||||
{
|
||||
name: 'mobile',
|
||||
name: 'content',
|
||||
direction: 'ASC',
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue