2025-05-09 16:00:58 -05:00
|
|
|
<script lang="ts">
|
2025-05-15 09:35:21 -06:00
|
|
|
import PinCodeChangeForm from '$lib/components/user-settings-page/PinCodeChangeForm.svelte';
|
|
|
|
|
import PinCodeCreateForm from '$lib/components/user-settings-page/PinCodeCreateForm.svelte';
|
2025-08-07 15:07:31 -04:00
|
|
|
import PinCodeResetModal from '$lib/modals/PinCodeResetModal.svelte';
|
2025-05-15 09:35:21 -06:00
|
|
|
import { getAuthStatus } from '@immich/sdk';
|
2025-08-07 15:07:31 -04:00
|
|
|
import { modalManager } from '@immich/ui';
|
2025-05-09 16:00:58 -05:00
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
import { fade } from 'svelte/transition';
|
|
|
|
|
|
|
|
|
|
let hasPinCode = $state(false);
|
|
|
|
|
|
|
|
|
|
onMount(async () => {
|
2025-05-15 09:35:21 -06:00
|
|
|
const { pinCode } = await getAuthStatus();
|
|
|
|
|
hasPinCode = pinCode;
|
2025-05-09 16:00:58 -05:00
|
|
|
});
|
2025-08-07 15:07:31 -04:00
|
|
|
|
|
|
|
|
const handleResetPINCode = async () => {
|
|
|
|
|
const success = await modalManager.show(PinCodeResetModal, {});
|
|
|
|
|
if (success) {
|
|
|
|
|
hasPinCode = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-05-09 16:00:58 -05:00
|
|
|
</script>
|
|
|
|
|
|
2025-08-07 15:07:31 -04:00
|
|
|
<section>
|
2025-05-15 09:35:21 -06:00
|
|
|
{#if hasPinCode}
|
2025-08-07 15:07:31 -04:00
|
|
|
<div in:fade={{ duration: 200 }}>
|
|
|
|
|
<PinCodeChangeForm onForgot={handleResetPINCode} />
|
2025-05-15 09:35:21 -06:00
|
|
|
</div>
|
|
|
|
|
{:else}
|
2025-08-07 15:07:31 -04:00
|
|
|
<div in:fade={{ duration: 200 }}>
|
2025-05-15 09:35:21 -06:00
|
|
|
<PinCodeCreateForm onCreated={() => (hasPinCode = true)} />
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
2025-05-09 16:00:58 -05:00
|
|
|
</section>
|