More improvements to the passcode lock process

This commit is contained in:
Scott Idem
2025-04-18 15:23:55 -04:00
parent 6d235d9159
commit 1828b0f141
2 changed files with 20 additions and 18 deletions

View File

@@ -20,15 +20,15 @@ import { events_loc } from '$lib/ae_events_stores';
// *** Setup Svelte properties
interface Props {
log_lvl?: number;
// data?: any;
show_passcode_input: boolean;
trigger_clear_access: null|boolean;
hidden: null|boolean;
}
let {
log_lvl = 0,
// data = null,
show_passcode_input = false,
trigger_clear_access = null,
hidden = true,
}: Props = $props();
@@ -110,6 +110,7 @@ $effect(() => {
let access_checks_results = ae_util.process_permission_checks('');
$ae_loc = {...$ae_loc, ...access_checks_results};
$ae_loc = $ae_loc;
}
});
@@ -125,6 +126,16 @@ $effect(async () => {
}
});
$effect(async () => {
if (trigger_clear_access) {
trigger_clear_access = false;
if (log_lvl) {
console.log(`trigger_clear_access=${trigger_clear_access}`);
}
handle_clear_access();
}
});
function handle_check_access_type_passcode() {
if (log_lvl > 1) {
@@ -225,6 +236,7 @@ function handle_check_access_type_passcode() {
}
function handle_clear_access() {
// console.log('handle_clear_access()');
// NOTE: I think it makes since to reset this to anonymous even if logged in as an admin or similar.
window.localStorage.setItem('access_type', 'anonymous');
@@ -409,7 +421,8 @@ function handle_clear_access() {
<button
type="button"
onclick={() => {
handle_clear_access();
// handle_clear_access();
trigger_clear_access = true;
}}
class="btn btn-sm variant-outline-surface hover:variant-ghost-warning transition-all"
title="Access mode is currently enabled/unlocked. Click to exit and lock."