Skip to content

Commit 2051257

Browse files
committed
fix: 🐛 Don't store invalid passphrase in cache
1 parent f4bf484 commit 2051257

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

app/pages/woman.client.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ onMounted(() => {
2424
2525
const decryptData = async (): Promise<void> => {
2626
if (!passphrase.value) {
27-
passphrase.value =
28-
prompt("Enter your decryption passphrase (this will be cached):") ||
29-
"";
27+
const input = prompt(
28+
"Enter your decryption passphrase (this will be cached):",
29+
);
30+
31+
if (input === null) {
32+
return;
33+
}
34+
35+
passphrase.value = input;
3036
}
3137
3238
const decrypter = new Decrypter();
@@ -38,6 +44,7 @@ const decryptData = async (): Promise<void> => {
3844
data.value = JSON.parse(decrypted) as Item[];
3945
} catch (error) {
4046
alert("Decryption failed. Please check your passphrase and try again.");
47+
passphrase.value = ""; // Clear invalid passphrase
4148
}
4249
};
4350
</script>

0 commit comments

Comments
 (0)