More improvements to the passcode lock process
This commit is contained in:
@@ -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."
|
||||
|
||||
@@ -75,6 +75,7 @@ if (log_lvl > 1) {
|
||||
console.log(`ae_root +layout.svelte data:`, data);
|
||||
}
|
||||
|
||||
let trigger_clear_access: null|boolean = $state(null);
|
||||
|
||||
// let account_id = localStorage.getItem('ae_account_id');
|
||||
// console.log(`account_id = `, account_id);
|
||||
@@ -514,19 +515,6 @@ $effect(() => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// function 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');
|
||||
|
||||
// // $ae_loc.access_type = null; // 'anonymous';
|
||||
// $ae_loc.access_type = 'anonymous';
|
||||
// trigger = 'process_permission_check';
|
||||
|
||||
// $ae_loc.app_cfg.show_element__passcode_input = false;
|
||||
// return true;
|
||||
// }
|
||||
</script>
|
||||
|
||||
{#if $ae_loc?.site_google_tracking_id && $ae_loc?.site_google_tracking_id.length > 0}
|
||||
@@ -757,12 +745,12 @@ max-w-max -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
// handle_clear_access();
|
||||
trigger_clear_access = true;
|
||||
|
||||
if ($ae_loc?.app_cfg?.show_element__menu_btn) {
|
||||
$ae_loc.app_cfg.show_element__menu = true;
|
||||
$ae_loc.app_cfg.show_element__menu_btn = false;
|
||||
$ae_loc.app_cfg.show_element__access_type = false;
|
||||
$ae_loc.app_cfg.show_element__access_type = true;
|
||||
} else {
|
||||
$ae_loc.app_cfg.show_element__menu = false;
|
||||
$ae_loc.app_cfg.show_element__menu_btn = true;
|
||||
@@ -891,6 +879,7 @@ max-w-max -->
|
||||
{#if $ae_loc.app_cfg?.show_element__access_type}
|
||||
<Element_access_type
|
||||
show_passcode_input={$ae_loc.app_cfg.show_element__passcode_input}
|
||||
trigger_clear_access={trigger_clear_access}
|
||||
hidden={$ae_loc.iframe && !$ae_loc.trusted_access}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user