chore(frontend): 개발 서버에서 로그인 폼 기본 계정 채움
.env.development 의 VITE_DEFAULT_LOGIN_* 로만 채워지고 빌드·테스트엔 안 들어감. 라벨 '비번' → '비밀번호'. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
# 개발 서버 전용 — 로그인 폼 기본값 (5_django_backend 시드 계정). 빌드·테스트엔 안 들어감.
|
||||||
|
VITE_DEFAULT_LOGIN_EMAIL=admin@codeassist.local
|
||||||
|
VITE_DEFAULT_LOGIN_PASSWORD=test1234
|
||||||
@@ -8,11 +8,16 @@ const envSchema = z.object({
|
|||||||
z.string().regex(/^\/[^\s]*$/, "must be absolute URL or path starting with '/'"),
|
z.string().regex(/^\/[^\s]*$/, "must be absolute URL or path starting with '/'"),
|
||||||
]),
|
]),
|
||||||
VITE_ENTRA_GRAPH_SCOPE: z.string().min(1).default("User.Read"),
|
VITE_ENTRA_GRAPH_SCOPE: z.string().min(1).default("User.Read"),
|
||||||
|
// 개발 편의 — 로그인 폼 기본값. .env.development 에만 두고 빌드/테스트엔 안 들어감.
|
||||||
|
VITE_DEFAULT_LOGIN_EMAIL: z.string().default(""),
|
||||||
|
VITE_DEFAULT_LOGIN_PASSWORD: z.string().default(""),
|
||||||
})
|
})
|
||||||
|
|
||||||
export interface AppEnv {
|
export interface AppEnv {
|
||||||
apiBaseUrl: string
|
apiBaseUrl: string
|
||||||
entraGraphScope: string
|
entraGraphScope: string
|
||||||
|
defaultLoginEmail: string
|
||||||
|
defaultLoginPassword: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseEnv(raw: Record<string, unknown>): AppEnv {
|
export function parseEnv(raw: Record<string, unknown>): AppEnv {
|
||||||
@@ -20,6 +25,8 @@ export function parseEnv(raw: Record<string, unknown>): AppEnv {
|
|||||||
return {
|
return {
|
||||||
apiBaseUrl: parsed.VITE_API_BASE_URL,
|
apiBaseUrl: parsed.VITE_API_BASE_URL,
|
||||||
entraGraphScope: parsed.VITE_ENTRA_GRAPH_SCOPE,
|
entraGraphScope: parsed.VITE_ENTRA_GRAPH_SCOPE,
|
||||||
|
defaultLoginEmail: parsed.VITE_DEFAULT_LOGIN_EMAIL,
|
||||||
|
defaultLoginPassword: parsed.VITE_DEFAULT_LOGIN_PASSWORD,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { useLogin } from "../hooks/useLogin"
|
|||||||
import { safeRedirectPath } from "../utils/safeRedirectPath"
|
import { safeRedirectPath } from "../utils/safeRedirectPath"
|
||||||
import { ApiError } from "@/lib/api/errors"
|
import { ApiError } from "@/lib/api/errors"
|
||||||
import type { LoginRequest } from "@/types/api"
|
import type { LoginRequest } from "@/types/api"
|
||||||
|
import { env } from "@/config/env"
|
||||||
|
|
||||||
export default function LoginForm() {
|
export default function LoginForm() {
|
||||||
const {
|
const {
|
||||||
@@ -19,7 +20,8 @@ export default function LoginForm() {
|
|||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm<LoginInput>({
|
} = useForm<LoginInput>({
|
||||||
resolver: zodResolver(loginSchema),
|
resolver: zodResolver(loginSchema),
|
||||||
defaultValues: { email: "", password: "" },
|
// 개발 서버에선 .env.development 의 기본 계정이 채워져 있어 버튼만 누르면 됨
|
||||||
|
defaultValues: { email: env.defaultLoginEmail, password: env.defaultLoginPassword },
|
||||||
})
|
})
|
||||||
const login = useLogin()
|
const login = useLogin()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@@ -53,7 +55,7 @@ export default function LoginForm() {
|
|||||||
{errors.email && <p className="text-destructive text-sm">{errors.email.message}</p>}
|
{errors.email && <p className="text-destructive text-sm">{errors.email.message}</p>}
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="password">비번</Label>
|
<Label htmlFor="password">비밀번호</Label>
|
||||||
<Input
|
<Input
|
||||||
id="password"
|
id="password"
|
||||||
type="password"
|
type="password"
|
||||||
|
|||||||
Reference in New Issue
Block a user