fixupdateUser
This commit is contained in:
parent
bfc6c0294e
commit
07b944dae5
|
|
@ -90,7 +90,9 @@ export async function getChangePasswordChannels(params, context, innerLogic) {
|
|||
userId,
|
||||
ableState: 'enabled',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
const [user] = await context.select('user', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -99,7 +101,9 @@ export async function getChangePasswordChannels(params, context, innerLogic) {
|
|||
filter: {
|
||||
id: userId,
|
||||
}
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true
|
||||
});
|
||||
const result = [];
|
||||
if (mobileList.length > 0) {
|
||||
result.push('mobile');
|
||||
|
|
@ -117,8 +121,13 @@ export async function updateUserPassword(params, context, innerLogic) {
|
|||
data: {
|
||||
id: 1,
|
||||
password: 1,
|
||||
}
|
||||
}, {});
|
||||
},
|
||||
filter: {
|
||||
id: userId,
|
||||
},
|
||||
}, {
|
||||
dontCollect: true
|
||||
});
|
||||
if (prevPassword) {
|
||||
const [lastSuccessfulTemp] = await context.select('changePasswordTemp', {
|
||||
data: {
|
||||
|
|
@ -142,22 +151,28 @@ export async function updateUserPassword(params, context, innerLogic) {
|
|||
],
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
const count1 = await context.count('changePasswordTemp', {
|
||||
filter: lastSuccessfulTemp ? {
|
||||
userId,
|
||||
$$seq$$: {
|
||||
$gt: lastSuccessfulTemp.$$seq$$,
|
||||
filter: lastSuccessfulTemp
|
||||
? {
|
||||
userId,
|
||||
$$seq$$: {
|
||||
$gt: lastSuccessfulTemp.$$seq$$,
|
||||
},
|
||||
result: 'fail',
|
||||
}
|
||||
: {
|
||||
userId,
|
||||
$$createAt$$: {
|
||||
$gt: dayjs().startOf('day').valueOf(),
|
||||
},
|
||||
result: 'fail',
|
||||
},
|
||||
result: 'fail',
|
||||
} : {
|
||||
userId,
|
||||
$$createAt$$: {
|
||||
$gt: dayjs().startOf('day').valueOf(),
|
||||
},
|
||||
result: 'fail',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
if (count1 >= 5) {
|
||||
closeRootMode();
|
||||
return {
|
||||
|
|
@ -171,12 +186,14 @@ export async function updateUserPassword(params, context, innerLogic) {
|
|||
action: 'update',
|
||||
data: {
|
||||
password: newPassword,
|
||||
passwordSha1: encryptPasswordSha1(newPassword)
|
||||
passwordSha1: encryptPasswordSha1(newPassword),
|
||||
},
|
||||
filter: {
|
||||
id: userId,
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
await context.operate('changePasswordTemp', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
|
|
@ -187,7 +204,9 @@ export async function updateUserPassword(params, context, innerLogic) {
|
|||
newPassword,
|
||||
result: 'success',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
closeRootMode();
|
||||
return {
|
||||
result: 'success'
|
||||
|
|
@ -204,7 +223,9 @@ export async function updateUserPassword(params, context, innerLogic) {
|
|||
newPassword,
|
||||
result: 'fail',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
closeRootMode();
|
||||
return {
|
||||
result: '原密码不正确,请检查后输入',
|
||||
|
|
@ -224,19 +245,23 @@ export async function updateUserPassword(params, context, innerLogic) {
|
|||
},
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
if (aliveCaptcha) {
|
||||
await context.operate('user', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
data: {
|
||||
password: newPassword,
|
||||
passwordSha1: encryptPasswordSha1(newPassword)
|
||||
passwordSha1: encryptPasswordSha1(newPassword),
|
||||
},
|
||||
filter: {
|
||||
id: userId,
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
await context.operate('changePasswordTemp', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
|
|
@ -247,7 +272,9 @@ export async function updateUserPassword(params, context, innerLogic) {
|
|||
newPassword,
|
||||
result: 'success',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
closeRootMode();
|
||||
return {
|
||||
result: 'success'
|
||||
|
|
|
|||
|
|
@ -95,7 +95,9 @@ async function getChangePasswordChannels(params, context, innerLogic) {
|
|||
userId,
|
||||
ableState: 'enabled',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
const [user] = await context.select('user', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -104,7 +106,9 @@ async function getChangePasswordChannels(params, context, innerLogic) {
|
|||
filter: {
|
||||
id: userId,
|
||||
}
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true
|
||||
});
|
||||
const result = [];
|
||||
if (mobileList.length > 0) {
|
||||
result.push('mobile');
|
||||
|
|
@ -123,8 +127,13 @@ async function updateUserPassword(params, context, innerLogic) {
|
|||
data: {
|
||||
id: 1,
|
||||
password: 1,
|
||||
}
|
||||
}, {});
|
||||
},
|
||||
filter: {
|
||||
id: userId,
|
||||
},
|
||||
}, {
|
||||
dontCollect: true
|
||||
});
|
||||
if (prevPassword) {
|
||||
const [lastSuccessfulTemp] = await context.select('changePasswordTemp', {
|
||||
data: {
|
||||
|
|
@ -148,22 +157,28 @@ async function updateUserPassword(params, context, innerLogic) {
|
|||
],
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
const count1 = await context.count('changePasswordTemp', {
|
||||
filter: lastSuccessfulTemp ? {
|
||||
userId,
|
||||
$$seq$$: {
|
||||
$gt: lastSuccessfulTemp.$$seq$$,
|
||||
filter: lastSuccessfulTemp
|
||||
? {
|
||||
userId,
|
||||
$$seq$$: {
|
||||
$gt: lastSuccessfulTemp.$$seq$$,
|
||||
},
|
||||
result: 'fail',
|
||||
}
|
||||
: {
|
||||
userId,
|
||||
$$createAt$$: {
|
||||
$gt: (0, dayjs_1.default)().startOf('day').valueOf(),
|
||||
},
|
||||
result: 'fail',
|
||||
},
|
||||
result: 'fail',
|
||||
} : {
|
||||
userId,
|
||||
$$createAt$$: {
|
||||
$gt: (0, dayjs_1.default)().startOf('day').valueOf(),
|
||||
},
|
||||
result: 'fail',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
if (count1 >= 5) {
|
||||
closeRootMode();
|
||||
return {
|
||||
|
|
@ -177,12 +192,14 @@ async function updateUserPassword(params, context, innerLogic) {
|
|||
action: 'update',
|
||||
data: {
|
||||
password: newPassword,
|
||||
passwordSha1: (0, password_1.encryptPasswordSha1)(newPassword)
|
||||
passwordSha1: (0, password_1.encryptPasswordSha1)(newPassword),
|
||||
},
|
||||
filter: {
|
||||
id: userId,
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
await context.operate('changePasswordTemp', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'create',
|
||||
|
|
@ -193,7 +210,9 @@ async function updateUserPassword(params, context, innerLogic) {
|
|||
newPassword,
|
||||
result: 'success',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
closeRootMode();
|
||||
return {
|
||||
result: 'success'
|
||||
|
|
@ -210,7 +229,9 @@ async function updateUserPassword(params, context, innerLogic) {
|
|||
newPassword,
|
||||
result: 'fail',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
closeRootMode();
|
||||
return {
|
||||
result: '原密码不正确,请检查后输入',
|
||||
|
|
@ -230,19 +251,23 @@ async function updateUserPassword(params, context, innerLogic) {
|
|||
},
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
if (aliveCaptcha) {
|
||||
await context.operate('user', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'update',
|
||||
data: {
|
||||
password: newPassword,
|
||||
passwordSha1: (0, password_1.encryptPasswordSha1)(newPassword)
|
||||
passwordSha1: (0, password_1.encryptPasswordSha1)(newPassword),
|
||||
},
|
||||
filter: {
|
||||
id: userId,
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
await context.operate('changePasswordTemp', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'create',
|
||||
|
|
@ -253,7 +278,9 @@ async function updateUserPassword(params, context, innerLogic) {
|
|||
newPassword,
|
||||
result: 'success',
|
||||
},
|
||||
}, {});
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
closeRootMode();
|
||||
return {
|
||||
result: 'success'
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
declare const checkers: (import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "mobile", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "token", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "message", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "parasite", import("..").RuntimeCxt>)[];
|
||||
declare const checkers: (import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "token", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "mobile", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "message", import("..").RuntimeCxt> | import("oak-domain").Checker<import("../oak-app-domain").EntityDict, "parasite", import("..").RuntimeCxt>)[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
declare const _default: (import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "account", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>>)[];
|
||||
declare const _default: (import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "account", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>>)[];
|
||||
export default _default;
|
||||
|
|
|
|||
Loading…
Reference in New Issue