Fix login redirect
This commit is contained in:
parent
2f20b90dd9
commit
566f086191
@ -28,6 +28,7 @@ export default function useLoginHandler() {
|
||||
if (hexKey.length === 64) {
|
||||
if (!pin) throw new PinRequiredError();
|
||||
LoginStore.loginWithPrivateKey(await PinEncrypted.create(hexKey, pin));
|
||||
return;
|
||||
} else {
|
||||
throw new Error("INVALID PRIVATE KEY");
|
||||
}
|
||||
@ -39,12 +40,14 @@ export default function useLoginHandler() {
|
||||
const ent = generateBip39Entropy(key);
|
||||
const keyHex = entropyToPrivateKey(ent);
|
||||
LoginStore.loginWithPrivateKey(await PinEncrypted.create(keyHex, pin));
|
||||
return;
|
||||
} else if (key.length === 64) {
|
||||
if (!hasSubtleCrypto) {
|
||||
throw new Error(insecureMsg);
|
||||
}
|
||||
if (!pin) throw new PinRequiredError();
|
||||
LoginStore.loginWithPrivateKey(await PinEncrypted.create(key, pin));
|
||||
return;
|
||||
}
|
||||
|
||||
// public key logins
|
||||
|
@ -95,12 +95,14 @@ export default function LoginPage() {
|
||||
}, []);
|
||||
|
||||
async function doLogin(pin?: string) {
|
||||
setError("");
|
||||
try {
|
||||
await loginHandler.doLogin(key, pin);
|
||||
navigate("/");
|
||||
} catch (e) {
|
||||
if (e instanceof PinRequiredError) {
|
||||
setPin(true);
|
||||
return;
|
||||
}
|
||||
if (e instanceof Error) {
|
||||
setError(e.message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user