// login-screen.jsx — static client-side password gate. // NOTE: password is hardcoded and visible in the bundle — this is a light gate, // not real security. const LOGIN_PASSWORD = "skillsvideoPWD2026!&"; const AUTH_KEY = "autocut.authed"; function isAuthed() { return localStorage.getItem(AUTH_KEY) === "1"; } const TXT_LOGIN = { vi: { title: "SkilssVideo.AI", subtitle: "Nhập mật khẩu để tiếp tục", placeholder: "Mật khẩu", submit: "Đăng nhập", error: "Mật khẩu không đúng. Thử lại.", }, en: { title: "SkilssVideo.AI", subtitle: "Enter password to continue", placeholder: "Password", submit: "Sign in", error: "Wrong password. Try again.", }, }; function LoginScreen({ uiLang, onAuthenticated }) { const txt = TXT_LOGIN[uiLang] || TXT_LOGIN.vi; const [value, setValue] = React.useState(""); const [error, setError] = React.useState(false); const [shake, setShake] = React.useState(false); const inputRef = React.useRef(null); React.useEffect(() => { if (inputRef.current) inputRef.current.focus(); }, []); const submit = React.useCallback(() => { if (value === LOGIN_PASSWORD) { localStorage.setItem(AUTH_KEY, "1"); onAuthenticated(); return; } setError(true); setShake(true); setValue(""); setTimeout(() => setShake(false), 420); if (inputRef.current) inputRef.current.focus(); }, [value, onAuthenticated]); const onKeyDown = (e) => { if (e.key === "Enter") submit(); }; return (
{txt.title}
{txt.subtitle}
{ setValue(e.target.value); if (error) setError(false); }} onKeyDown={onKeyDown} style={{ width: "100%", padding: "11px 13px", fontSize: 14, background: "var(--bg-0)", color: "var(--fg-0)", border: `1px solid ${error ? "var(--err)" : "var(--line)"}`, borderRadius: "var(--radius)", outline: "none", }} /> {error && (
{txt.error}
)}
); }