File tree Expand file tree Collapse file tree
infrastructure/eid-wallet/src/routes/(app)/settings/pin
blabsy/src/components/user Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : " Build All Packages"
22
33on :
4- pull_request :
5- push :
6- branches :
7- - " dev"
8- - " main"
4+ pull_request :
5+ push :
6+ branches :
7+ - " dev"
8+ - " main"
99
1010jobs :
1111 build :
Original file line number Diff line number Diff line change 11<script lang =" ts" >
2+ import type { GlobalState } from " $lib/global" ;
23import { runtime } from " $lib/global/runtime.svelte" ;
34import { ButtonAction , Drawer , InputPin } from " $lib/ui" ;
45import { CircleLock01Icon } from " @hugeicons/core-free-icons" ;
56import { HugeiconsIcon } from " @hugeicons/svelte" ;
7+ import { getContext , onMount } from " svelte" ;
68
9+ let globalState: GlobalState | undefined = $state (undefined );
710let currentPin = $state (" " );
811let newPin = $state (" " );
912let repeatPin = $state (" " );
@@ -16,14 +19,35 @@ const handleClose = async () => {
1619};
1720
1821const handleChangePIN = async () => {
19- if (repeatPin .length === 4 && newPin !== repeatPin ) isError = true ;
20- if (! isError ) showDrawer = true ;
22+ if (newPin .length < 4 || repeatPin .length < 4 || currentPin .length < 4 ) {
23+ isError = true ;
24+ return ;
25+ }
26+
27+ if (newPin !== repeatPin ) {
28+ isError = true ;
29+ return ;
30+ }
31+
32+ try {
33+ await globalState ?.securityController .updatePin (currentPin , newPin );
34+ isError = false ;
35+ showDrawer = true ;
36+ } catch (err ) {
37+ console .error (" Failed to update PIN:" , err );
38+ isError = true ;
39+ }
2140};
2241
2342$effect (() => {
2443 runtime .header .title = " Change PIN" ;
2544 if (repeatPin .length === 4 && newPin === repeatPin ) isError = false ;
2645});
46+
47+ onMount (() => {
48+ globalState = getContext <() => GlobalState >(" globalState" )();
49+ if (! globalState ) throw new Error (" Global state is not defined" );
50+ });
2751 </script >
2852
2953<main
Original file line number Diff line number Diff line change @@ -59,7 +59,11 @@ export function UserFollowStats({
5959 < p className = 'font-bold text-light-primary dark:text-dark-primary' >
6060 { stats }
6161 </ p >
62- < p > { index === 1 && statsValue > 1 ? `${ title } s` : title } </ p >
62+ < p >
63+ { index === 1 && statsValue > 1
64+ ? `${ title } s`
65+ : title }
66+ </ p >
6367 </ div >
6468 ) ;
6569 } ) }
Original file line number Diff line number Diff line change 9898 },
9999 "optionalDependencies" : {
100100 "bufferutil" : " ^4.0.8"
101+ },
102+ "pnpm" : {
103+ "overrides" : {
104+ "react" : " 18.3.1" ,
105+ "react-dom" : " 18.3.1" ,
106+ "@types/react" : " 18.3.11" ,
107+ "@types/react-dom" : " 18.3.1"
108+ }
101109 }
102110}
You can’t perform that action at this time.
0 commit comments