Require PIN on every visit to the parent dashboard
Remove sessionStorage caching of the PIN so the gate always shows on page load instead of auto-unlocking from a previous session. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
2accefd122
commit
8f3f7634ff
1 file changed
+1
-3
+1
-3
@@ -6,7 +6,7 @@ const esc = (s) =>
|
|||||||
({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])
|
({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])
|
||||||
);
|
);
|
||||||
|
|
||||||
let parentPin = sessionStorage.getItem('pin') || null;
|
let parentPin = null;
|
||||||
|
|
||||||
async function api(path, opts = {}) {
|
async function api(path, opts = {}) {
|
||||||
const headers = { 'Content-Type': 'application/json' };
|
const headers = { 'Content-Type': 'application/json' };
|
||||||
@@ -51,7 +51,6 @@ $('#pin-form').addEventListener('submit', async (e) => {
|
|||||||
const { ok } = await api('/api/parent/verify', { method: 'POST', body: { pin } });
|
const { ok } = await api('/api/parent/verify', { method: 'POST', body: { pin } });
|
||||||
if (!ok) return ($('#pin-error').hidden = false);
|
if (!ok) return ($('#pin-error').hidden = false);
|
||||||
parentPin = pin;
|
parentPin = pin;
|
||||||
sessionStorage.setItem('pin', pin);
|
|
||||||
$('#pin-error').hidden = true;
|
$('#pin-error').hidden = true;
|
||||||
unlock();
|
unlock();
|
||||||
});
|
});
|
||||||
@@ -1833,7 +1832,6 @@ $('#pin-change-form').addEventListener('submit', async (e) => {
|
|||||||
try {
|
try {
|
||||||
await api('/api/parent/pin', { method: 'POST', body: { newPin } });
|
await api('/api/parent/pin', { method: 'POST', body: { newPin } });
|
||||||
parentPin = newPin;
|
parentPin = newPin;
|
||||||
sessionStorage.setItem('pin', newPin);
|
|
||||||
$('#new-pin').value = '';
|
$('#new-pin').value = '';
|
||||||
msg('PIN changed.');
|
msg('PIN changed.');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in new issue
Block a user