비밀번호 변경 페이지 구현

This commit is contained in:
static
2025-01-13 02:53:32 +09:00
parent 299787537e
commit 8bb4d70fa5
10 changed files with 99 additions and 14 deletions

View File

@@ -3,15 +3,16 @@
import type { SvelteHTMLElements } from "svelte/elements";
interface Props {
icon?: Component<SvelteHTMLElements["svg"]>;
children: Snippet;
icon?: Component<SvelteHTMLElements["svg"]>;
topPadding?: boolean;
}
let { icon: Icon, children }: Props = $props();
let { topPadding = true, children, icon: Icon }: Props = $props();
</script>
<div>
<div class="box-content flex min-h-[10vh] items-center pt-4">
<div class="box-content flex min-h-[10vh] items-center {topPadding ? 'pt-4' : ''}">
{#if Icon}
<Icon class="text-5xl text-gray-600" />
{/if}

View File

@@ -41,8 +41,8 @@ export const refreshSession = async (
.update(session)
.set({
lastUsedAt: now,
lastUsedByIp: ip,
lastUsedByUserAgent: userAgent,
lastUsedByIp: ip ?? undefined,
lastUsedByUserAgent: userAgent ?? undefined,
})
.where(
and(

View File

@@ -5,12 +5,12 @@ export const setAgentInfoMiddleware: Handle = async ({ event, resolve }) => {
const userAgent = event.request.headers.get("User-Agent");
if (!ip) {
error(500, "IP address not found");
} else if (!userAgent) {
} else if (!userAgent && !event.isSubRequest) {
error(400, "User agent not found");
}
event.locals.ip = ip;
event.locals.userAgent = userAgent;
event.locals.userAgent = userAgent ?? "";
return await resolve(event);
};

View File

@@ -1,10 +1,10 @@
import { z } from "zod";
export const changePasswordRequest = z.object({
export const passwordChangeRequest = z.object({
oldPassword: z.string().trim().nonempty(),
newPassword: z.string().trim().nonempty(),
});
export type ChangePasswordRequest = z.infer<typeof changePasswordRequest>;
export type PasswordChangeRequest = z.infer<typeof passwordChangeRequest>;
export const loginRequest = z.object({
email: z.string().email().nonempty(),