captcha type字段添加confirm

This commit is contained in:
qsc 2023-08-19 14:53:39 +08:00
parent d62d822423
commit 28fe879dcd
19 changed files with 34 additions and 26 deletions

View File

@ -49,7 +49,7 @@ export declare type GeneralAspectDict<ED extends EntityDict, Cxt extends Backend
sendCaptcha: (params: {
mobile: string;
env: WechatMpEnv | WebEnv;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
}, context: Cxt) => Promise<string>;
getApplication: (params: {
type: AppType;

View File

@ -47,7 +47,7 @@ export declare function syncUserInfoWechatMp<ED extends EntityDict, Cxt extends
export declare function sendCaptcha<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ mobile, env, type: type2 }: {
mobile: string;
env: WechatMpEnv | WebEnv;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
}, context: Cxt): Promise<string>;
export declare function switchTo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ userId }: {
userId: string;

View File

@ -8,5 +8,5 @@ export interface Schema extends EntityShape {
env: Object;
expired: Boolean;
expiresAt: Datetime;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
}

View File

@ -38,7 +38,8 @@ var entityDesc = {
},
type: {
login: '登录',
changePassword: '修改密码'
changePassword: '修改密码',
confirm: '校验',
}
},
},

View File

@ -34,7 +34,7 @@ export declare class Token<ED extends EntityDict, Cxt extends BackendRuntimeCont
* @returns
*/
isReallyRoot(context?: FrontCxt): boolean;
sendCaptcha(mobile: string, type: 'login' | 'changePassword'): Promise<string>;
sendCaptcha(mobile: string, type: 'login' | 'changePassword' | 'confirm'): Promise<string>;
switchTo(userId: string): Promise<void>;
refreshWechatPublicUserInfo(): Promise<void>;
getWechatMpUserPhoneNumber(code: string): Promise<void>;

View File

@ -12,7 +12,7 @@ export declare type OpSchema = EntityShape & {
env: Object;
expired: Boolean;
expiresAt: Datetime;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
iState?: IState | null;
};
export declare type OpAttr = keyof OpSchema;
@ -24,7 +24,7 @@ export declare type Schema = EntityShape & {
env: Object;
expired: Boolean;
expiresAt: Datetime;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
iState?: IState | null;
} & {
[A in ExpressionKey]?: any;
@ -41,7 +41,7 @@ declare type AttrFilter = {
env: Object;
expired: Q_BooleanValue;
expiresAt: Q_DateValue;
type: Q_EnumValue<'login' | 'changePassword'>;
type: Q_EnumValue<'login' | 'changePassword' | 'confirm'>;
iState: Q_EnumValue<IState>;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;

View File

@ -40,7 +40,7 @@ exports.desc = {
type: {
notNull: true,
type: "enum",
enumeration: ["login", "changePassword"]
enumeration: ["login", "changePassword", "confirm"]
},
iState: {
type: "enum",

View File

@ -1 +1 @@
{ "name": "验证码", "attr": { "mobile": "手机号", "code": "验证码", "visitorId": "用户标识", "reason": "失败原因", "env": "用户环境", "expired": "是否过期", "expiresAt": "过期时间", "iState": "状态", "type": "类型" }, "action": { "send": "发送", "fail": "失败", "success": "成功" }, "v": { "iState": { "unsent": "未发送", "sending": "发送中", "sent": "已发送", "failure": "已失败" }, "type": { "login": "登录", "changePassword": "修改密码" } } }
{ "name": "验证码", "attr": { "mobile": "手机号", "code": "验证码", "visitorId": "用户标识", "reason": "失败原因", "env": "用户环境", "expired": "是否过期", "expiresAt": "过期时间", "iState": "状态", "type": "类型" }, "action": { "send": "发送", "fail": "失败", "success": "成功" }, "v": { "iState": { "unsent": "未发送", "sending": "发送中", "sent": "已发送", "failure": "已失败" }, "type": { "login": "登录", "changePassword": "修改密码", "confirm": "校验" } } }

View File

@ -1,8 +1,10 @@
import { AuthCascadePath, AuthDeduceRelationMap, SelectFreeEntities } from "oak-domain/lib/types/Entity";
import { AuthCascadePath, AuthDeduceRelationMap } from "oak-domain/lib/types/Entity";
import { EntityDict } from "./EntityDict";
import { CreateOperationData as Relation } from "./Relation/Schema";
export declare const ActionCascadePathGraph: AuthCascadePath<EntityDict>[];
export declare const RelationCascadePathGraph: AuthCascadePath<EntityDict>[];
export declare const relations: Relation[];
export declare const deducedRelationMap: AuthDeduceRelationMap<EntityDict>;
export declare const selectFreeEntities: SelectFreeEntities<EntityDict>;
export declare const selectFreeEntities: (keyof EntityDict)[];
export declare const updateFreeEntities: (keyof EntityDict)[];
export declare const createFreeEntities: (keyof EntityDict)[];

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.selectFreeEntities = exports.deducedRelationMap = exports.relations = exports.RelationCascadePathGraph = exports.ActionCascadePathGraph = void 0;
exports.createFreeEntities = exports.updateFreeEntities = exports.selectFreeEntities = exports.deducedRelationMap = exports.relations = exports.RelationCascadePathGraph = exports.ActionCascadePathGraph = void 0;
exports.ActionCascadePathGraph = [
["changePasswordTemp", "user", "changePasswordTemp", false],
["email", "user", "email", false],
@ -31,3 +31,5 @@ exports.RelationCascadePathGraph = [];
exports.relations = [];
exports.deducedRelationMap = {};
exports.selectFreeEntities = [];
exports.updateFreeEntities = [];
exports.createFreeEntities = [];

View File

@ -81,7 +81,7 @@ export type GeneralAspectDict<
sendCaptcha: (params: {
mobile: string;
env: WechatMpEnv | WebEnv;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
}, context: Cxt) => Promise<string>;
getApplication: (
params: {

View File

@ -1488,7 +1488,7 @@ export async function sendCaptcha<
}: {
mobile: string;
env: WechatMpEnv | WebEnv;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
},
context: Cxt
): Promise<string> {

View File

@ -11,7 +11,7 @@ export interface Schema extends EntityShape {
env: Object;
expired: Boolean;
expiresAt: Datetime;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
};
type IState = 'unsent' | 'sending' | 'sent' | 'failure';
@ -60,7 +60,8 @@ const entityDesc: EntityDesc<Schema, Action, '', {
},
type: {
login: '登录',
changePassword: '修改密码'
changePassword: '修改密码',
confirm: '校验',
}
},
},

View File

@ -196,7 +196,7 @@ export class Token<
return !!token?.player?.isRoot;
}
async sendCaptcha(mobile: string, type: 'login' | 'changePassword') {
async sendCaptcha(mobile: string, type: 'login' | 'changePassword' | 'confirm') {
const env = await this.environment.getEnv();
const { result } = await this.cache.exec('sendCaptcha', {
mobile,

View File

@ -16,7 +16,7 @@ export type OpSchema = EntityShape & {
env: Object;
expired: Boolean;
expiresAt: Datetime;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
iState?: IState | null;
};
export type OpAttr = keyof OpSchema;
@ -28,7 +28,7 @@ export type Schema = EntityShape & {
env: Object;
expired: Boolean;
expiresAt: Datetime;
type: 'login' | 'changePassword';
type: 'login' | 'changePassword' | 'confirm';
iState?: IState | null;
} & {
[A in ExpressionKey]?: any;
@ -45,7 +45,7 @@ type AttrFilter = {
env: Object;
expired: Q_BooleanValue;
expiresAt: Q_DateValue;
type: Q_EnumValue<'login' | 'changePassword'>;
type: Q_EnumValue<'login' | 'changePassword' | 'confirm'>;
iState: Q_EnumValue<IState>;
};
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;

View File

@ -39,7 +39,7 @@ export const desc: StorageDesc<OpSchema> = {
type: {
notNull: true,
type: "enum",
enumeration: ["login", "changePassword"]
enumeration: ["login", "changePassword", "confirm"]
},
iState: {
type: "enum",

View File

@ -1 +1 @@
{"name":"验证码","attr":{"mobile":"手机号","code":"验证码","visitorId":"用户标识","reason":"失败原因","env":"用户环境","expired":"是否过期","expiresAt":"过期时间","iState":"状态","type":"类型"},"action":{"send":"发送","fail":"失败","success":"成功"},"v":{"iState":{"unsent":"未发送","sending":"发送中","sent":"已发送","failure":"已失败"},"type":{"login":"登录","changePassword":"修改密码"}}}
{"name":"验证码","attr":{"mobile":"手机号","code":"验证码","visitorId":"用户标识","reason":"失败原因","env":"用户环境","expired":"是否过期","expiresAt":"过期时间","iState":"状态","type":"类型"},"action":{"send":"发送","fail":"失败","success":"成功"},"v":{"iState":{"unsent":"未发送","sending":"发送中","sent":"已发送","failure":"已失败"},"type":{"login":"登录","changePassword":"修改密码","confirm":"校验"}}}

View File

@ -1,4 +1,4 @@
import { AuthCascadePath, AuthDeduceRelationMap, SelectFreeEntities } from "oak-domain/lib/types/Entity";
import { AuthCascadePath, AuthDeduceRelationMap } from "oak-domain/lib/types/Entity";
import { EntityDict } from "./EntityDict";
import { CreateOperationData as Relation } from "./Relation/Schema";
export const ActionCascadePathGraph: AuthCascadePath<EntityDict>[] = [
@ -30,4 +30,6 @@ export const ActionCascadePathGraph: AuthCascadePath<EntityDict>[] = [
export const RelationCascadePathGraph: AuthCascadePath<EntityDict>[] = [];
export const relations: Relation[] = [];
export const deducedRelationMap: AuthDeduceRelationMap<EntityDict> = {};
export const selectFreeEntities: SelectFreeEntities<EntityDict> = [];
export const selectFreeEntities: (keyof EntityDict)[] = [];
export const updateFreeEntities: (keyof EntityDict)[] = [];
export const createFreeEntities: (keyof EntityDict)[] = [];

View File

@ -1,6 +1,6 @@
import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import { Trigger, CreateTrigger, UpdateTrigger, SelectTrigger } from 'oak-domain/lib/types/Trigger';
import { CreateOperationData as CreateParasiteData } from '../general-app-domain/Parasite/Schema';
// import { CreateOperationData as CreateParasiteData } from '../general-app-domain/Parasite/Schema';
import { EntityDict } from '../oak-app-domain/EntityDict';
import { OakRowInconsistencyException, OakExternalException, SelectOpResult } from 'oak-domain/lib/types';