mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 06:58:46 +00:00
암호 키가 등록된 클라이언트에서 로그인을 수행하는 방식을 변경된 API에 맞게 변경
우선 이메일과 비밀번호를 이용해 로그인을 수행한 후, Token Upgrade를 수행하도록 변경했습니다.
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
import { TitleDiv, BottomDiv } from "$lib/components/divs";
|
||||
import { TextInput } from "$lib/components/inputs";
|
||||
import { refreshToken } from "$lib/hooks/callAPI";
|
||||
import { keyPairStore } from "$lib/stores";
|
||||
import { requestLogin } from "./service";
|
||||
import { keyPairsStore } from "$lib/stores";
|
||||
import { requestLogin, requestTokenUpgrade } from "./service";
|
||||
|
||||
let { data } = $props();
|
||||
|
||||
@@ -16,14 +16,23 @@
|
||||
const login = async () => {
|
||||
// TODO: Validation
|
||||
|
||||
if (await requestLogin(email, password, $keyPairStore)) {
|
||||
try {
|
||||
if (!(await requestLogin(email, password))) throw new Error("Failed to login");
|
||||
|
||||
if (
|
||||
$keyPairsStore &&
|
||||
!(await requestTokenUpgrade($keyPairsStore.encKeyPair, $keyPairsStore.sigKeyPair))
|
||||
)
|
||||
throw new Error("Failed to upgrade token");
|
||||
|
||||
await goto(
|
||||
$keyPairStore
|
||||
$keyPairsStore
|
||||
? data.redirectPath
|
||||
: "/key/generate?redirect=" + encodeURIComponent(data.redirectPath),
|
||||
);
|
||||
} else {
|
||||
} catch (e) {
|
||||
// TODO: Alert
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user