영업관리 통합로그인 자동로그인 3개 임시 생성

This commit is contained in:
2026-01-01 22:33:40 +09:00
parent bf7ecfd609
commit 02a5058512

View File

@@ -1436,15 +1436,14 @@
const [error, setError] = useState('');
const [loading, setLoading] = useState(false);
const handleLogin = async (e) => {
e.preventDefault();
const executeLogin = async (id, pw) => {
setLoading(true);
setError('');
try {
const res = await fetch('api/sales_members.php?action=login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ member_id: memberId, password })
body: JSON.stringify({ member_id: id, password: pw })
});
const data = await res.json();
if (data.success) {
@@ -1463,6 +1462,17 @@
}
};
const handleLogin = (e) => {
e.preventDefault();
executeLogin(memberId, password);
};
const handleAutoLogin = (id, pw) => {
setMemberId(id);
setPassword(pw);
executeLogin(id, pw);
};
return (
<div className="min-h-[calc(100vh-64px)] flex items-center justify-center p-4">
<div className="max-w-md w-full bg-white rounded-2xl shadow-xl border border-slate-100 p-8">
@@ -1524,17 +1534,26 @@
<div className="mt-10 pt-8 border-t border-slate-100">
<h4 className="text-[10px] font-black text-slate-400 uppercase tracking-widest text-center mb-4">테스트용 계정 정보</h4>
<div className="grid grid-cols-1 gap-2">
<div className="flex items-center justify-between p-2 bg-slate-50 rounded-lg border border-slate-100">
<span className="text-xs font-bold text-slate-500">운영자</span>
<span className="text-xs font-mono text-slate-600">admin / admin</span>
<div
onClick={() => handleAutoLogin('admin', 'admin')}
className="flex items-center justify-between p-3 bg-slate-50 rounded-xl border border-slate-100 cursor-pointer hover:bg-blue-50 hover:border-blue-200 transition-all group shadow-sm"
>
<span className="text-xs font-bold text-slate-500 group-hover:text-blue-600">운영자</span>
<span className="text-xs font-mono text-slate-600 group-hover:text-blue-500">admin / admin</span>
</div>
<div className="flex items-center justify-between p-2 bg-slate-50 rounded-lg border border-slate-100">
<span className="text-xs font-bold text-slate-500">영업관리</span>
<span className="text-xs font-mono text-slate-600">sales / sales</span>
<div
onClick={() => handleAutoLogin('sales', 'sales')}
className="flex items-center justify-between p-3 bg-slate-50 rounded-xl border border-slate-100 cursor-pointer hover:bg-blue-50 hover:border-blue-200 transition-all group shadow-sm"
>
<span className="text-xs font-bold text-slate-500 group-hover:text-blue-600">영업관리</span>
<span className="text-xs font-mono text-slate-600 group-hover:text-blue-500">sales / sales</span>
</div>
<div className="flex items-center justify-between p-2 bg-slate-50 rounded-lg border border-slate-100">
<span className="text-xs font-bold text-slate-500">매니저</span>
<span className="text-xs font-mono text-slate-600">manager / manager</span>
<div
onClick={() => handleAutoLogin('manager', 'manager')}
className="flex items-center justify-between p-3 bg-slate-50 rounded-xl border border-slate-100 cursor-pointer hover:bg-blue-50 hover:border-blue-200 transition-all group shadow-sm"
>
<span className="text-xs font-bold text-slate-500 group-hover:text-blue-600">매니저</span>
<span className="text-xs font-mono text-slate-600 group-hover:text-blue-500">manager / manager</span>
</div>
</div>
</div>