Files
goldenChart/frontend/src/utils/loginDefaults.ts
T
2026-06-15 13:21:42 +09:00

24 lines
770 B
TypeScript

import { isDesktop } from './platform';
export const DEV_LOGIN_USERNAME = 'admin';
export const DEV_LOGIN_PASSWORD = 'admin123!!';
/** 로컬 dev·localhost·Desktop — 로그인 폼 admin / admin123!! 자동 입력 */
export function shouldPrefillLoginCredentials(): boolean {
if (isDesktop()) return true;
if (import.meta.env.DEV) return true;
if (typeof window !== 'undefined') {
const host = window.location.hostname;
if (host === 'localhost' || host === '127.0.0.1') return true;
}
return false;
}
export function getLoginDefaultUsername(): string {
return shouldPrefillLoginCredentials() ? DEV_LOGIN_USERNAME : '';
}
export function getLoginDefaultPassword(): string {
return shouldPrefillLoginCredentials() ? DEV_LOGIN_PASSWORD : '';
}