mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
add mfa listing use build-in forms
This commit is contained in:
@ -50,6 +50,7 @@ export enum ApiEndpoints {
|
|||||||
icons = 'icons/',
|
icons = 'icons/',
|
||||||
selectionlist_list = 'selection/',
|
selectionlist_list = 'selection/',
|
||||||
selectionlist_detail = 'selection/:id/',
|
selectionlist_detail = 'selection/:id/',
|
||||||
|
securtiy_settings = '_allauth/app/v1/config',
|
||||||
|
|
||||||
// Barcode API endpoints
|
// Barcode API endpoints
|
||||||
barcode = 'barcode/',
|
barcode = 'barcode/',
|
||||||
|
@ -68,10 +68,7 @@ export function SecurityContent() {
|
|||||||
<Title order={5}>
|
<Title order={5}>
|
||||||
<Trans>Multifactor</Trans>
|
<Trans>Multifactor</Trans>
|
||||||
</Title>
|
</Title>
|
||||||
{isLoadingProvider ? (
|
|
||||||
<Loader />
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
{isMfaEnabled ? (
|
{isMfaEnabled ? (
|
||||||
<MfaContent />
|
<MfaContent />
|
||||||
) : (
|
) : (
|
||||||
@ -85,8 +82,6 @@ export function SecurityContent() {
|
|||||||
</Trans>
|
</Trans>
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Title order={5}>
|
<Title order={5}>
|
||||||
<Trans>Token</Trans>
|
<Trans>Token</Trans>
|
||||||
|
@ -4,13 +4,13 @@ import { createJSONStorage, persist } from 'zustand/middleware';
|
|||||||
import { api } from '../App';
|
import { api } from '../App';
|
||||||
import { emptyServerAPI } from '../defaults/defaults';
|
import { emptyServerAPI } from '../defaults/defaults';
|
||||||
import { ApiEndpoints } from '../enums/ApiEndpoints';
|
import { ApiEndpoints } from '../enums/ApiEndpoints';
|
||||||
import type { AuthProps, ServerAPIProps } from './states';
|
import type { SecuritySetting, ServerAPIProps } from './states';
|
||||||
|
|
||||||
interface ServerApiStateProps {
|
interface ServerApiStateProps {
|
||||||
server: ServerAPIProps;
|
server: ServerAPIProps;
|
||||||
setServer: (newServer: ServerAPIProps) => void;
|
setServer: (newServer: ServerAPIProps) => void;
|
||||||
fetchServerApiState: () => void;
|
fetchServerApiState: () => void;
|
||||||
auth_settings?: AuthProps;
|
auth_settings?: SecuritySetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useServerApiState = create<ServerApiStateProps>()(
|
export const useServerApiState = create<ServerApiStateProps>()(
|
||||||
@ -31,11 +31,11 @@ export const useServerApiState = create<ServerApiStateProps>()(
|
|||||||
|
|
||||||
// Fetch login/SSO behaviour
|
// Fetch login/SSO behaviour
|
||||||
await api
|
await api
|
||||||
.get(apiUrl(ApiEndpoints.sso_providers), {
|
.get(apiUrl(ApiEndpoints.securtiy_settings), {
|
||||||
headers: { Authorization: '' }
|
headers: { Authorization: '' }
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
set({ auth_settings: response.data });
|
set({ auth_settings: response.data.data });
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.error('ERR: Error fetching SSO information');
|
console.error('ERR: Error fetching SSO information');
|
||||||
|
@ -59,6 +59,26 @@ export interface AuthProps {
|
|||||||
password_forgotten_enabled: boolean;
|
password_forgotten_enabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SecuritySetting {
|
||||||
|
account: {
|
||||||
|
authentication_method: string;
|
||||||
|
};
|
||||||
|
socialaccount: { providers: Provider[] };
|
||||||
|
mfa: {
|
||||||
|
supported_types: string[];
|
||||||
|
};
|
||||||
|
usersessions: {
|
||||||
|
track_activity: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Provider {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
flows: string[];
|
||||||
|
client_id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Provider {
|
export interface Provider {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
Reference in New Issue
Block a user