mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-27 14:16:02 +00:00
feat(frontend): remove old deps (#12857)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
@@ -59,7 +59,6 @@
|
||||
"@fullcalendar/daygrid": "^6.1.21",
|
||||
"@fullcalendar/interaction": "^6.1.21",
|
||||
"@fullcalendar/react": "6.1.21",
|
||||
"@github/webauthn-json": "^2.1.1",
|
||||
"@lingui/core": "^5.9.2",
|
||||
"@lingui/react": "^5.9.2",
|
||||
"@mantine/carousel": "^9.2.1",
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
import {
|
||||
type CredentialRequestOptionsJSON,
|
||||
get,
|
||||
parseRequestOptionsFromJSON
|
||||
} from '@github/webauthn-json/browser-ponyfill';
|
||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||
import { apiUrl } from '@lib/functions/Api';
|
||||
import { getBaseUrl } from '@lib/functions/Navigation';
|
||||
@@ -798,11 +793,9 @@ export async function handleWebauthnLogin(
|
||||
}
|
||||
|
||||
try {
|
||||
const credential = await get(
|
||||
parseRequestOptionsFromJSON(
|
||||
webauthn_challenge as CredentialRequestOptionsJSON
|
||||
)
|
||||
);
|
||||
const publicKey =
|
||||
PublicKeyCredential.parseRequestOptionsFromJSON(webauthn_challenge);
|
||||
const credential = await navigator.credentials.get({ publicKey });
|
||||
await api
|
||||
.post(apiUrl(ApiEndpoints.auth_webauthn_login), {
|
||||
credential: credential
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { create } from '@github/webauthn-json/browser-ponyfill';
|
||||
import { CopyButton } from '@lib/components/CopyButton';
|
||||
import { StylishText } from '@lib/components/StylishText';
|
||||
import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||
@@ -761,44 +760,46 @@ export default function MFASettings() {
|
||||
|
||||
// Register a WebAuthn credential with the provided key
|
||||
const registerWebauthn = useCallback((key: any) => {
|
||||
create({
|
||||
publicKey: PublicKeyCredential.parseCreationOptionsFromJSON(key)
|
||||
}).then((credential) => {
|
||||
const credentialString: string = JSON.stringify(credential);
|
||||
navigator.credentials
|
||||
.create({
|
||||
publicKey: PublicKeyCredential.parseCreationOptionsFromJSON(key)
|
||||
})
|
||||
.then((credential) => {
|
||||
const credentialString: string = JSON.stringify(credential);
|
||||
|
||||
api
|
||||
.post(
|
||||
apiUrl(ApiEndpoints.auth_webauthn),
|
||||
{
|
||||
name: 'Master Key',
|
||||
credential: credentialString
|
||||
},
|
||||
{
|
||||
timeout: 30 * 1000
|
||||
}
|
||||
)
|
||||
.then((response) => {
|
||||
showNotification({
|
||||
title: t`WebAuthn Registered`,
|
||||
message: t`WebAuthn credential registered successfully`,
|
||||
color: 'green',
|
||||
icon: <IconCircleCheck />
|
||||
api
|
||||
.post(
|
||||
apiUrl(ApiEndpoints.auth_webauthn),
|
||||
{
|
||||
name: 'Master Key',
|
||||
credential: credentialString
|
||||
},
|
||||
{
|
||||
timeout: 30 * 1000
|
||||
}
|
||||
)
|
||||
.then((response) => {
|
||||
showNotification({
|
||||
title: t`WebAuthn Registered`,
|
||||
message: t`WebAuthn credential registered successfully`,
|
||||
color: 'green',
|
||||
icon: <IconCircleCheck />
|
||||
});
|
||||
refetch();
|
||||
})
|
||||
.catch((error) => {
|
||||
const errorMsg = extractErrorMessage(
|
||||
error,
|
||||
t`Error registering WebAuthn credential`
|
||||
);
|
||||
showNotification({
|
||||
title: t`WebAuthn Registration Failed`,
|
||||
message: `${t`Failed to register WebAuthn credential`}: ${errorMsg}`,
|
||||
color: 'red',
|
||||
icon: <IconExclamationCircle />
|
||||
});
|
||||
});
|
||||
refetch();
|
||||
})
|
||||
.catch((error) => {
|
||||
const errorMsg = extractErrorMessage(
|
||||
error,
|
||||
t`Error registering WebAuthn credential`
|
||||
);
|
||||
showNotification({
|
||||
title: t`WebAuthn Registration Failed`,
|
||||
message: `${t`Failed to register WebAuthn credential`}: ${errorMsg}`,
|
||||
color: 'red',
|
||||
icon: <IconExclamationCircle />
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}, []);
|
||||
|
||||
// Request a WebAuthn registration challenge from the server
|
||||
|
||||
@@ -987,11 +987,6 @@
|
||||
resolved "https://registry.yarnpkg.com/@fullcalendar/react/-/react-6.1.21.tgz#6f396ab7460d3ad9d07f4c32b1ac483b9b21120f"
|
||||
integrity sha512-TLpmGUd5k/PMdCh8XbeFC9PW9wuGvMms1oCxWgXyjK3EFPXAAd0PLfcvwKdyxoAS5eK1E4RJFkjMHvsYHpimcg==
|
||||
|
||||
"@github/webauthn-json@^2.1.1":
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@github/webauthn-json/-/webauthn-json-2.1.1.tgz#648e63fc28050917d2882cc2b27817a88cb420fc"
|
||||
integrity sha512-XrftRn4z75SnaJOmZQbt7Mk+IIjqVHw+glDGOxuHwXkZBZh/MBoRS7MHjSZMDaLhT4RjN2VqiEU7EOYleuJWSQ==
|
||||
|
||||
"@istanbuljs/load-nyc-config@^1.0.0", "@istanbuljs/load-nyc-config@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
|
||||
|
||||
Reference in New Issue
Block a user