mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-25 07:51:51 +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": {
|
"login": {
|
||||||
"title": "Login to your account",
|
"title": "Login to your account",
|
||||||
"description": "Please enter your passphrase to 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",
|
"deviceLengthError": "Please enter a device name",
|
||||||
"submit": "Login",
|
"submit": "Login",
|
||||||
"passphraseLabel": "12-Word passphrase",
|
"passphraseLabel": "12-Word passphrase",
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"passphrasePlaceholder": "Passphrase",
|
"passphrasePlaceholder": "Passphrase",
|
||||||
"submit": "Hoist Anchor",
|
"submit": "Hoist Anchor",
|
||||||
"title": "Hoist the Jolly Roger",
|
"title": "Hoist the Jolly Roger",
|
||||||
"validationError": "Arr, invalid or incomplete passphrase"
|
"validationError": "Arr, incorrect or incomplete passphrase"
|
||||||
},
|
},
|
||||||
"register": {
|
"register": {
|
||||||
"information": {
|
"information": {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import { useAsyncFn } from "react-use";
|
import { useAsyncFn } from "react-use";
|
||||||
|
import type { AsyncReturnType } from "type-fest";
|
||||||
|
|
||||||
import { verifyValidMnemonic } from "@/backend/accounts/crypto";
|
import { verifyValidMnemonic } from "@/backend/accounts/crypto";
|
||||||
import { Button } from "@/components/buttons/Button";
|
import { Button } from "@/components/buttons/Button";
|
||||||
@ -37,12 +38,19 @@ export function LoginFormPart(props: LoginFormPartProps) {
|
|||||||
if (validatedDevice.length === 0)
|
if (validatedDevice.length === 0)
|
||||||
throw new Error(t("auth.login.deviceLengthError") ?? undefined);
|
throw new Error(t("auth.login.deviceLengthError") ?? undefined);
|
||||||
|
|
||||||
const account = await login({
|
let account: AsyncReturnType<typeof login>;
|
||||||
mnemonic: inputMnemonic,
|
try {
|
||||||
userData: {
|
account = await login({
|
||||||
device: validatedDevice,
|
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);
|
await importData(account, progressItems, bookmarkItems);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user