refactor: identity -> iam
This commit is contained in:
14
modules/iam/routes/login/email/handle.ts
Normal file
14
modules/iam/routes/login/email/handle.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { auth } from "../../../services/auth.ts";
|
||||
import { logger } from "../../../services/logger.ts";
|
||||
import route from "./spec.ts";
|
||||
|
||||
export default route.access("public").handle(async ({ body: { email } }) => {
|
||||
const response = await auth.api.sendVerificationOTP({ body: { email, type: "sign-in" } });
|
||||
if (response.success === false) {
|
||||
logger.info({
|
||||
type: "auth:passwordless",
|
||||
message: "OTP Email verification failed.",
|
||||
received: email,
|
||||
});
|
||||
}
|
||||
});
|
||||
8
modules/iam/routes/login/email/spec.ts
Normal file
8
modules/iam/routes/login/email/spec.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { route } from "@platform/relay";
|
||||
import z from "zod";
|
||||
|
||||
export default route.post("/api/v1/identity/login/email").body(
|
||||
z.object({
|
||||
email: z.email(),
|
||||
}),
|
||||
);
|
||||
Reference in New Issue
Block a user