Skip to content

Commit 5f41b17

Browse files
grv-saini-20coodos
andauthored
fix: reset-pin (#417)
* fix: reset-pin * fix: format and lint * fix: format and lint * fix: build --------- Co-authored-by: Merul Dhiman <69296233+coodos@users.noreply.github.com>
1 parent c80cf92 commit 5f41b17

4 files changed

Lines changed: 44 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: "Build All Packages"
22

33
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- "dev"
8-
- "main"
4+
pull_request:
5+
push:
6+
branches:
7+
- "dev"
8+
- "main"
99

1010
jobs:
1111
build:

infrastructure/eid-wallet/src/routes/(app)/settings/pin/+page.svelte

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<script lang="ts">
2+
import type { GlobalState } from "$lib/global";
23
import { runtime } from "$lib/global/runtime.svelte";
34
import { ButtonAction, Drawer, InputPin } from "$lib/ui";
45
import { CircleLock01Icon } from "@hugeicons/core-free-icons";
56
import { HugeiconsIcon } from "@hugeicons/svelte";
7+
import { getContext, onMount } from "svelte";
68
9+
let globalState: GlobalState | undefined = $state(undefined);
710
let currentPin = $state("");
811
let newPin = $state("");
912
let repeatPin = $state("");
@@ -16,14 +19,35 @@ const handleClose = async () => {
1619
};
1720
1821
const 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

platforms/blabsy/src/components/user/user-follow-stats.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff 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
})}

platforms/dreamSync/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,13 @@
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
}

0 commit comments

Comments
 (0)