Skip to content

Commit 0c65c0d

Browse files
committed
added limitchanged
1 parent 7a595b1 commit 0c65c0d

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/routes/(console)/project-[region]-[project]/auth/security/passwordPolicies.svelte

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@
4343
});
4444
4545
const hasChanges = $derived.by(() => {
46-
const dictChanged = passwordDictionary !== project.authPasswordDictionary;
47-
const dataCheckChanged = authPersonalDataCheck !== project.authPersonalDataCheck;
48-
const historyChanged = passwordHistoryEnabled !== (project.authPasswordHistory !== 0);
49-
50-
return historyChanged || dictChanged || dataCheckChanged;
46+
const dictChanged = passwordDictionary !== (project.authPasswordDictionary ?? false);
47+
const dataCheckChanged = authPersonalDataCheck !== (project.authPersonalDataCheck ?? false);
48+
const historyChanged =
49+
passwordHistoryEnabled !== ((project.authPasswordHistory ?? 0) !== 0);
50+
const limitChanged =
51+
passwordHistoryEnabled &&
52+
Number(passwordHistory) !== (project.authPasswordHistory ?? 0);
53+
54+
return historyChanged || dictChanged || dataCheckChanged || limitChanged;
5155
});
5256
5357
async function updatePasswordPolicies() {

src/routes/(console)/project-[region]-[project]/auth/security/sessionSecurity.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@
88
import { sdk } from '$lib/stores/sdk';
99
import { Typography } from '@appwrite.io/pink-svelte';
1010
import type { Models } from '@appwrite.io/console';
11+
import { onMount } from 'svelte';
1112
1213
let { project }: { project: Models.Project } = $props();
1314
1415
let authSessionAlerts = $state(false);
1516
let sessionInvalidation = $state(false);
1617
17-
// Initialize state from project
18-
$effect(() => {
18+
onMount(() => {
1919
authSessionAlerts = project?.authSessionAlerts ?? false;
2020
sessionInvalidation = project?.authInvalidateSessions ?? false;
2121
});
2222
23-
const hasChanges = $derived(
24-
authSessionAlerts !== (project?.authSessionAlerts ?? false) ||
25-
sessionInvalidation !== (project?.authInvalidateSessions ?? false)
26-
);
23+
const hasChanges = $derived.by(() => {
24+
const alertsChanged = authSessionAlerts !== (project?.authSessionAlerts ?? false);
25+
const invalidationChanged =
26+
sessionInvalidation !== (project?.authInvalidateSessions ?? false);
27+
return alertsChanged || invalidationChanged;
28+
});
2729
2830
async function updateSessionSecurity() {
2931
try {

0 commit comments

Comments
 (0)