diff --git a/poverty-mapping/index.html b/poverty-mapping/index.html index afe27eb..9c42d13 100644 --- a/poverty-mapping/index.html +++ b/poverty-mapping/index.html @@ -514,6 +514,7 @@ function openAuthModal(mode){ fields.innerHTML = '
'+ ''+ ''+ + ''+ ''+ ''+ ''+ @@ -575,6 +576,21 @@ function openAuthModal(mode){ try{ let resp, jr; if(mode === 'register'){ + // Validate password length and match + const passwordInput = form.querySelector('input[name="password"]'); + const password = passwordInput ? passwordInput.value : ''; + const passwordConfirmInput = form.querySelector('input[name="password_confirm"]'); + const passwordConfirm = passwordConfirmInput ? passwordConfirmInput.value : ''; + + if(password.length < 8){ + showToast('Password minimal harus 8 karakter', 'error', 5000); + return; + } + if(password !== passwordConfirm){ + showToast('Konfirmasi password tidak cocok', 'error', 5000); + return; + } + // client-side validation for org_proof: size <=5MB and allowed extensions const fileInput = form.querySelector('input[name="org_proof"]') || document.getElementById('org_proof_input'); if(!fileInput){ showToast('Input bukti organisasi tidak ditemukan', 'error', 4000); return; } @@ -595,7 +611,7 @@ function openAuthModal(mode){ } const fd = new FormData(form); - resp = await fetch(endpoint, { method: 'POST', headers: buildHeaders(), body: fd, credentials: 'same-origin' }); + resp = await fetch(endpoint, { method: 'POST', headers: buildHeaders(null), body: fd, credentials: 'same-origin' }); jr = await resp.json().catch(()=>null); } else { const fd = new FormData(form);