diff --git a/poverty-mapping/index.html b/poverty-mapping/index.html
index 017c42f..fd39a83 100644
--- a/poverty-mapping/index.html
+++ b/poverty-mapping/index.html
@@ -687,23 +687,15 @@ function openAuthModal(mode){
return;
}
- // Client-side rate limiting check
+ // Client-side cooldown check
const limitKey = 'webgis_limit_' + btoa(email);
- let limitInfo = { attempts: 0, lastTime: 0, lockedUntil: 0 };
+ let limitInfo = { lastTime: 0 };
try{
const cached = localStorage.getItem(limitKey);
if(cached) limitInfo = JSON.parse(cached);
}catch(e){}
const now = Date.now();
- if(limitInfo.lockedUntil && now < limitInfo.lockedUntil){
- const diff = limitInfo.lockedUntil - now;
- const hours = Math.floor(diff / (3600 * 1000));
- const mins = Math.ceil((diff % (3600 * 1000)) / (60 * 1000));
- showToast(`Batas pengiriman kode tercapai. Anda harus menunggu ${hours} jam ${mins} menit lagi.`, 'error', 5000);
- return;
- }
-
if(limitInfo.lastTime && now - limitInfo.lastTime < 30 * 1000){
const remaining = Math.ceil((30 * 1000 - (now - limitInfo.lastTime)) / 1000);
showToast(`Silakan tunggu ${remaining} detik sebelum mengirim kembali.`, 'error', 3000);
@@ -725,26 +717,13 @@ function openAuthModal(mode){
if(!resp.ok || (jr && jr.success === false)){
const errMessage = jr && jr.message ? jr.message : (jr && jr.error ? jr.error : 'Gagal mengirim kode');
showToast(errMessage, 'error', 5000);
-
- // If locked on server side, sync client side state
- if(jr && jr.error === 'locked_24h' && jr.locked_until){
- limitInfo.lockedUntil = jr.locked_until;
- try{ localStorage.setItem(limitKey, JSON.stringify(limitInfo)); }catch(e){}
- }
-
sendCodeBtn.disabled = false;
sendCodeBtn.textContent = 'Kirim Kode Verifikasi';
return;
}
- // Update client side rate limiting on success
- limitInfo.attempts = (limitInfo.lockedUntil && now >= limitInfo.lockedUntil) ? 1 : (limitInfo.attempts + 1);
+ // Update client side cooldown info on success
limitInfo.lastTime = now;
- if(limitInfo.attempts >= 3){
- limitInfo.lockedUntil = now + 24 * 3600 * 1000;
- } else {
- limitInfo.lockedUntil = 0;
- }
try{ localStorage.setItem(limitKey, JSON.stringify(limitInfo)); }catch(e){}
authRegisterState.code_sent = true;
@@ -756,10 +735,10 @@ function openAuthModal(mode){
codeInput.value = jr.debug_code;
showToast('Gagal mengirim email. Menggunakan kode pengujian: ' + jr.debug_code, 'warning', 8000);
}
+ } else {
+ showToast('Kode verifikasi terkirim ke email Anda! Silakan cek email Anda.', 'success', 6000);
}
- showToast('Kode verifikasi terkirim ke email Anda! Silakan cek email Anda.', 'success', 6000);
-
// Cooldown countdown timer
let cooldown = 30;
sendCodeBtn.disabled = true;