mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
add setting for configuring types
This commit is contained in:
@ -379,6 +379,7 @@ InvenTree provides allowance for additional sign-in options. The following optio
|
|||||||
| Environment Variable | Configuration File | Description | Default |
|
| Environment Variable | Configuration File | Description | Default |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| INVENTREE_MFA_ENABLED | mfa_enabled | Enable or disable multi-factor authentication support for the InvenTree server | True |
|
| INVENTREE_MFA_ENABLED | mfa_enabled | Enable or disable multi-factor authentication support for the InvenTree server | True |
|
||||||
|
| MFA_SUPPORTED_TYPES | mfa_supported_types | List of supported multi-factor authentication types | recovery_codes,totp |
|
||||||
|
|
||||||
### Single Sign On
|
### Single Sign On
|
||||||
|
|
||||||
|
@ -1304,7 +1304,15 @@ HEADLESS_FRONTEND_URLS = {
|
|||||||
}
|
}
|
||||||
HEADLESS_ONLY = True
|
HEADLESS_ONLY = True
|
||||||
HEADLESS_TOKEN_STRATEGY = 'InvenTree.auth_overrides.DRFTokenStrategy'
|
HEADLESS_TOKEN_STRATEGY = 'InvenTree.auth_overrides.DRFTokenStrategy'
|
||||||
MFA_ENABLED = get_boolean_setting('INVENTREE_MFA_ENABLED', 'mfa_enabled', True)
|
MFA_ENABLED = get_boolean_setting(
|
||||||
|
'INVENTREE_MFA_ENABLED', 'mfa_enabled', True
|
||||||
|
) # TODO re-implement
|
||||||
|
MFA_SUPPORTED_TYPES = get_setting(
|
||||||
|
'INVENTREE_MFA_SUPPORTED_TYPES',
|
||||||
|
'mfa_supported_types',
|
||||||
|
['totp', 'recovery_codes'],
|
||||||
|
typecast=list,
|
||||||
|
)
|
||||||
|
|
||||||
LOGOUT_REDIRECT_URL = get_setting(
|
LOGOUT_REDIRECT_URL = get_setting(
|
||||||
'INVENTREE_LOGOUT_REDIRECT_URL', 'logout_redirect_url', 'index'
|
'INVENTREE_LOGOUT_REDIRECT_URL', 'logout_redirect_url', 'index'
|
||||||
|
@ -445,6 +445,7 @@ function MfaAddSection({
|
|||||||
refetch: () => void;
|
refetch: () => void;
|
||||||
showRecoveryCodes: (codes: Recoverycodes) => void;
|
showRecoveryCodes: (codes: Recoverycodes) => void;
|
||||||
}>) {
|
}>) {
|
||||||
|
const [auth_config] = useServerApiState((state) => [state.auth_config]);
|
||||||
const [totpQrOpen, { open: openTotpQr, close: closeTotpQr }] =
|
const [totpQrOpen, { open: openTotpQr, close: closeTotpQr }] =
|
||||||
useDisclosure(false);
|
useDisclosure(false);
|
||||||
const [totpQr, setTotpQr] = useState<{ totp_url: string; secret: string }>();
|
const [totpQr, setTotpQr] = useState<{ totp_url: string; secret: string }>();
|
||||||
@ -507,8 +508,10 @@ function MfaAddSection({
|
|||||||
function: registerRecoveryCodes,
|
function: registerRecoveryCodes,
|
||||||
used: usedFactors?.includes('recovery_codes')
|
used: usedFactors?.includes('recovery_codes')
|
||||||
}
|
}
|
||||||
];
|
].filter((factor) => {
|
||||||
}, [usedFactors]);
|
auth_config?.mfa.supported_types.includes(factor.type);
|
||||||
|
});
|
||||||
|
}, [usedFactors, auth_config]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
|
Reference in New Issue
Block a user