mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 06:58:46 +00:00
토큰에 클라이언트 정보를 함께 저장하도록 변경
This commit is contained in:
@@ -8,15 +8,15 @@ export const POST: RequestHandler = async ({ request }) => {
|
||||
.object({
|
||||
email: z.string().email().nonempty(),
|
||||
password: z.string().nonempty(),
|
||||
pubKey: z.string().nonempty().optional(),
|
||||
})
|
||||
.safeParse(await request.json());
|
||||
if (!zodRes.success) error(400, zodRes.error.message);
|
||||
|
||||
const { email, password } = zodRes.data;
|
||||
const loginRes = await login(email.trim(), password.trim());
|
||||
const { email, password, pubKey } = zodRes.data;
|
||||
const loginRes = await login(email.trim(), password.trim(), pubKey?.trim());
|
||||
if (!loginRes) error(401, "Invalid email, password, or public key");
|
||||
|
||||
if (!loginRes) error(401, "Invalid email or password");
|
||||
const { accessToken, refreshToken } = loginRes;
|
||||
|
||||
return json({ accessToken, refreshToken });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user