mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-24 19:31:49 +01:00
Better error for unknown account
Co-authored-by: mrjvs <mistrjvs@gmail.com>
This commit is contained in:
parent
056fabb266
commit
95c5e73996
@ -17,7 +17,7 @@
|
||||
"login": {
|
||||
"title": "Login to your account",
|
||||
"description": "Please enter your passphrase to login to your account",
|
||||
"validationError": "Invalid or incomplete passphrase",
|
||||
"validationError": "Incorrect or incomplete passphrase",
|
||||
"deviceLengthError": "Please enter a device name",
|
||||
"submit": "Login",
|
||||
"passphraseLabel": "12-Word passphrase",
|
||||
|
@ -16,7 +16,7 @@
|
||||
"passphrasePlaceholder": "Passphrase",
|
||||
"submit": "Hoist Anchor",
|
||||
"title": "Hoist the Jolly Roger",
|
||||
"validationError": "Arr, invalid or incomplete passphrase"
|
||||
"validationError": "Arr, incorrect or incomplete passphrase"
|
||||
},
|
||||
"register": {
|
||||
"information": {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { useAsyncFn } from "react-use";
|
||||
import type { AsyncReturnType } from "type-fest";
|
||||
|
||||
import { verifyValidMnemonic } from "@/backend/accounts/crypto";
|
||||
import { Button } from "@/components/buttons/Button";
|
||||
@ -37,12 +38,19 @@ export function LoginFormPart(props: LoginFormPartProps) {
|
||||
if (validatedDevice.length === 0)
|
||||
throw new Error(t("auth.login.deviceLengthError") ?? undefined);
|
||||
|
||||
const account = await login({
|
||||
mnemonic: inputMnemonic,
|
||||
userData: {
|
||||
device: validatedDevice,
|
||||
},
|
||||
});
|
||||
let account: AsyncReturnType<typeof login>;
|
||||
try {
|
||||
account = await login({
|
||||
mnemonic: inputMnemonic,
|
||||
userData: {
|
||||
device: validatedDevice,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
if ((err as any).status === 401)
|
||||
throw new Error(t("auth.login.validationError") ?? undefined);
|
||||
throw err;
|
||||
}
|
||||
|
||||
await importData(account, progressItems, bookmarkItems);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user