DESTRA
Home
Pages
About Us
Terms of Service
Disclaimer
Contact Us
Categories
Business
Culture
Design & Media
Finance
Forex
General
Lifestyle
Marketing
Productivity
Technology
Login
Hello,
{ await fetch('/api/auth/logout', { method: 'POST', headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}); localStorage.clear(); window.location.href='/'; }" class="text-red-600 hover:text-red-700 text-sm font-bold transition">Logout
Dashboard
Home
Pages
About Us
Terms of Service
Disclaimer
Contact Us
Categories
Business
Culture
Design & Media
Finance
Forex
General
Lifestyle
Marketing
Productivity
Technology
Login
Hello,
{ await fetch('/api/auth/logout', { method: 'POST', headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}); localStorage.clear(); window.location.href='/'; }" class="block w-full text-left px-4 py-2 text-red-600 hover:bg-red-50 rounded-lg font-bold">Logout
Dashboard
{ if(!$refs.user.value || !$refs.pass.value || !captchaInput) return alert('Please fill all fields'); const endpoint = isRegister ? '/api/auth/register' : '/api/auth/login'; const payload = { username: $refs.user.value, password: $refs.pass.value, captcha_hash: captchaHash, captcha_answer: captchaInput }; const res = await fetch(endpoint, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(payload) }); const data = await res.json(); if (res.ok) { if (!isRegister) { localStorage.setItem('user_id', data.user.id); localStorage.setItem('token', data.token); localStorage.setItem('role', data.user.role); localStorage.setItem('username', data.user.username); if (data.user.role === 'pembaca') { window.location.href = '/welcome'; } else { window.location.href = '/admin'; } } else { alert(data.message || 'Registrasi berhasil!'); isRegister = false; loadCaptcha(); } } else { alert(data.error); loadCaptcha(); } }">
Security Code
Refresh
300" x-show="show" @click="window.scrollTo({top: 0, behavior: 'smooth'})" class="fixed bottom-8 right-8 bg-gray-900 text-white w-12 h-12 rounded-full shadow-xl hover:bg-gray-800 transition-all duration-300 flex items-center justify-center z-40">