diff --git a/public/index.html b/public/index.html index f88e0d9..7eddf0c 100644 --- a/public/index.html +++ b/public/index.html @@ -1571,7 +1571,7 @@
- (PIN: 1234) + (4 dígitos)
diff --git a/public/js/app.js b/public/js/app.js index 8e046ab..978ae07 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1148,10 +1148,6 @@ function onTransferTargetIdentified(target) { pinInput.value = ''; pinInput.type = 'password'; } - const pinHint = document.getElementById('lblTransferPinHint'); - if (pinHint && currentStudent) { - pinHint.textContent = `(PIN: ${currentStudent.pin_seguridad || '1234'})`; - } document.getElementById('transferStepScan').style.display = 'none'; document.getElementById('transferStepConfirm').style.display = 'block'; @@ -1493,7 +1489,7 @@ async function executeP2PTransfer() { const pin = document.getElementById('inputTransferPin').value.trim(); if (!pin) { if (window.sounds) window.sounds.playError(); - return alert('Por favor ingresa tu PIN de seguridad (por defecto 1234).'); + return alert('Por favor ingresa tu PIN de seguridad.'); } const motivo = document.getElementById('inputTransferMotivo').value.trim(); diff --git a/server/db.js b/server/db.js index 86572b3..f902448 100644 --- a/server/db.js +++ b/server/db.js @@ -494,8 +494,8 @@ function seedInitialData() { '+506 8999-0011' ); - // Asegurar que todos los estudiantes tengan el PIN 1234 estándar para el piloto - db.prepare("UPDATE estudiantes SET pin_seguridad = '1234' WHERE pin_seguridad IS NULL OR pin_seguridad != '1234'").run(); + // Asignar PIN por defecto únicamente si algún estudiante no tiene PIN definido + db.prepare("UPDATE estudiantes SET pin_seguridad = '1234' WHERE pin_seguridad IS NULL OR pin_seguridad = ''").run(); console.log('✅ Base de datos inicializada con éxito.'); } @@ -763,14 +763,14 @@ function transferenciaP2PTransaction({ emisorId, qrReceptor, receptorId, monto, throw new Error('Tus padres tienen desactivadas las transferencias entre compañeros en tu perfil'); } - // 2. Validar PIN de seguridad del emisor (permite 1234 universal o el PIN personalizado) + // 2. Validar PIN de seguridad del emisor (debe coincidir exactamente con su PIN registrado) const pinIngresado = String(pin || '').trim(); - const pinEstudiante = String(emisor.pin_seguridad || '1234').trim(); + const pinEstudiante = String(emisor.pin_seguridad || '').trim(); if (!pinIngresado) { - throw new Error('Debes ingresar tu PIN de 4 dígitos para transferir'); + throw new Error('Debes ingresar tu PIN de seguridad'); } - if (pinIngresado !== '1234' && pinIngresado !== pinEstudiante) { - throw new Error(`PIN de seguridad incorrecto. Tu PIN es ${pinEstudiante}`); + if (pinIngresado !== pinEstudiante) { + throw new Error('El PIN de seguridad es incorrecto.'); } // 3. Obtener receptor (por ID o por escaneo de QR/código de carné)