mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 15:08:46 +00:00
암호 키 유무에 따른 자동 리다이렉션 구현
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { get } from "svelte/store";
|
||||
import { goto } from "$app/navigation";
|
||||
import { Button, TextButton } from "$lib/components/buttons";
|
||||
import { TitleDiv, BottomDiv } from "$lib/components/divs";
|
||||
import { TextInput } from "$lib/components/inputs";
|
||||
import { keyPairStore } from "$lib/stores";
|
||||
import { requestLogin } from "./service";
|
||||
|
||||
let { data } = $props();
|
||||
@@ -13,9 +15,12 @@
|
||||
const login = async () => {
|
||||
// TODO: Validation
|
||||
|
||||
const ok = await requestLogin(email, password);
|
||||
if (ok) {
|
||||
goto(data.redirectPath);
|
||||
if (await requestLogin(email, password)) {
|
||||
await goto(
|
||||
get(keyPairStore)
|
||||
? data.redirectPath
|
||||
: "/key/generate?redirect=" + encodeURIComponent(data.redirectPath),
|
||||
);
|
||||
} else {
|
||||
// TODO: Alert
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { storeKeyPairIntoIndexedDB } from "$lib/indexedDB";
|
||||
import { keyPairStore } from "$lib/stores";
|
||||
|
||||
type KeyType = "public" | "private";
|
||||
@@ -48,7 +47,6 @@ export const generateKeyPair = async () => {
|
||||
publicKey: keyPair.publicKey,
|
||||
privateKey: privKeySecured,
|
||||
});
|
||||
await storeKeyPairIntoIndexedDB(keyPair.publicKey, privKeySecured);
|
||||
|
||||
return {
|
||||
pubKeyBase64: await exportKeyToBase64(keyPair.publicKey, "public"),
|
||||
|
||||
Reference in New Issue
Block a user