0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(core): fix

This commit is contained in:
Darcy Ye 2022-09-30 10:24:33 +08:00
parent 07485a6e6c
commit 5e42aed784
No known key found for this signature in database
GPG key ID: B46F4C07EDEFC610
2 changed files with 6 additions and 6 deletions

View file

@ -169,7 +169,7 @@ export default function passwordlessRoutes<T extends AnonymousRouter>(
ctx.log(type, { userId: id });
await updateUserById(id, { lastSignInAt: Date.now() });
await assignInteractionResults(ctx, provider, { login: { accountId: id } }, true);
await assignInteractionResults(ctx, provider, { login: { accountId: id } });
return next();
});
@ -187,7 +187,7 @@ export default function passwordlessRoutes<T extends AnonymousRouter>(
ctx.log(type, { userId: id });
await updateUserById(id, { lastSignInAt: Date.now() });
await assignInteractionResults(ctx, provider, { login: { accountId: id } }, true);
await assignInteractionResults(ctx, provider, { login: { accountId: id } });
return next();
});
@ -205,7 +205,7 @@ export default function passwordlessRoutes<T extends AnonymousRouter>(
ctx.log(type, { userId: id });
await insertUser({ id, primaryPhone: phone, lastSignInAt: Date.now() });
await assignInteractionResults(ctx, provider, { login: { accountId: id } }, true);
await assignInteractionResults(ctx, provider, { login: { accountId: id } });
return next();
});
@ -223,7 +223,7 @@ export default function passwordlessRoutes<T extends AnonymousRouter>(
ctx.log(type, { userId: id });
await insertUser({ id, primaryEmail: email, lastSignInAt: Date.now() });
await assignInteractionResults(ctx, provider, { login: { accountId: id } }, true);
await assignInteractionResults(ctx, provider, { login: { accountId: id } });
return next();
});

View file

@ -50,7 +50,7 @@ export const getPasswordlessRelatedLogType = (
return result.data;
};
export const verificationStorageParser = (data: unknown): VerificationStorage => {
export const parseVerificationStorage = (data: unknown): VerificationStorage => {
const verificationResult = z
.object({
verification: verificationStorageGuard,
@ -92,7 +92,7 @@ export const getAndCheckVerificationStorage = async (
flowType: FlowType
): Promise<Pick<VerificationStorage, 'email' | 'phone'>> => {
const { result } = await provider.interactionDetails(ctx.req, ctx.res);
const { email, phone, flow, expiresAt } = verificationStorageParser(result);
const { email, phone, flow, expiresAt } = parseVerificationStorage(result);
ctx.log(logType, { email, phone, flow, expiresAt });