File tree Expand file tree Collapse file tree
src/routes/(console)/project-[region]-[project]/auth/security Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script lang =" ts" >
22 import { Container } from ' $lib/layout' ;
3- import { page } from ' $app/state ' ;
3+ import type { PageProps } from ' ./$types ' ;
44 import UpdateMockNumbers from ' ./updateMockNumbers.svelte' ;
55 import UpdateMembershipPrivacy from ' ./updateMembershipPrivacy.svelte' ;
66 import UpdateUsersLimit from ' ./updateUsersLimit.svelte' ;
77 import UpdateSessionLength from ' ./updateSessionLength.svelte' ;
88 import UpdateSessionsLimit from ' ./updateSessionsLimit.svelte' ;
99 import PasswordPolicies from ' ./passwordPolicies.svelte' ;
1010 import SessionSecurity from ' ./sessionSecurity.svelte' ;
11+
12+ let { data }: PageProps = $props ();
1113 </script >
1214
1315<Container >
1416 <UpdateUsersLimit />
1517 <UpdateSessionLength />
1618 <UpdateSessionsLimit />
17- <PasswordPolicies project ={page . data .project } />
18- <SessionSecurity project ={page . data .project } />
19+ <PasswordPolicies project ={data .project } />
20+ <SessionSecurity project ={data .project } />
1921 <UpdateMockNumbers />
2022 <UpdateMembershipPrivacy />
2123</Container >
Original file line number Diff line number Diff line change 1616 let passwordHistoryEnabled = $state (false );
1717 let passwordDictionary = $state (false );
1818 let authPersonalDataCheck = $state (false );
19+ let lastValidLimit = $state (5 );
1920
2021 let maxPasswordInputField: InputNumber | null = null ;
2122
2223 // Initialize and sync state when project updates
2324 $effect (() => {
2425 const historyValue = project ?.authPasswordHistory ;
25- passwordHistory = historyValue < 1 ? 5 : historyValue ;
26+ if (historyValue && historyValue > 0 ) {
27+ passwordHistory = historyValue ;
28+ lastValidLimit = historyValue ;
29+ }
2630 passwordHistoryEnabled = (historyValue ?? 0 ) !== 0 ;
2731 passwordDictionary = project ?.authPasswordDictionary ?? false ;
2832 authPersonalDataCheck = project ?.authPersonalDataCheck ?? false ;
2933 });
3034
35+ // restore last valid limit when enabling
36+ $effect (() => {
37+ if (passwordHistoryEnabled && passwordHistory < 1 ) {
38+ passwordHistory = lastValidLimit ;
39+ }
40+ });
41+
3142 $effect (() => {
3243 if (passwordHistoryEnabled ) {
3344 tick ().then (() => {
You can’t perform that action at this time.
0 commit comments