diff --git a/src/frontend/src/enums/ApiEndpoints.tsx b/src/frontend/src/enums/ApiEndpoints.tsx index 1fa858f054..23231f6ee4 100644 --- a/src/frontend/src/enums/ApiEndpoints.tsx +++ b/src/frontend/src/enums/ApiEndpoints.tsx @@ -50,6 +50,7 @@ export enum ApiEndpoints { icons = 'icons/', selectionlist_list = 'selection/', selectionlist_detail = 'selection/:id/', + securtiy_settings = '_allauth/app/v1/config', // Barcode API endpoints barcode = 'barcode/', diff --git a/src/frontend/src/pages/Index/Settings/AccountSettings/SecurityContent.tsx b/src/frontend/src/pages/Index/Settings/AccountSettings/SecurityContent.tsx index 09ab73141a..ce7aa1b533 100644 --- a/src/frontend/src/pages/Index/Settings/AccountSettings/SecurityContent.tsx +++ b/src/frontend/src/pages/Index/Settings/AccountSettings/SecurityContent.tsx @@ -68,24 +68,19 @@ export function SecurityContent() { <Trans>Multifactor</Trans> - {isLoadingProvider ? ( - + + {isMfaEnabled ? ( + ) : ( - <> - {isMfaEnabled ? ( - - ) : ( - } - title={t`Not enabled`} - color='yellow' - > - - Multifactor authentication is not configured for your account{' '} - - - )} - + } + title={t`Not enabled`} + color='yellow' + > + + Multifactor authentication is not configured for your account{' '} + + )} diff --git a/src/frontend/src/states/ApiState.tsx b/src/frontend/src/states/ApiState.tsx index 6043111261..82989dd137 100644 --- a/src/frontend/src/states/ApiState.tsx +++ b/src/frontend/src/states/ApiState.tsx @@ -4,13 +4,13 @@ import { createJSONStorage, persist } from 'zustand/middleware'; import { api } from '../App'; import { emptyServerAPI } from '../defaults/defaults'; import { ApiEndpoints } from '../enums/ApiEndpoints'; -import type { AuthProps, ServerAPIProps } from './states'; +import type { SecuritySetting, ServerAPIProps } from './states'; interface ServerApiStateProps { server: ServerAPIProps; setServer: (newServer: ServerAPIProps) => void; fetchServerApiState: () => void; - auth_settings?: AuthProps; + auth_settings?: SecuritySetting; } export const useServerApiState = create<ServerApiStateProps>()( @@ -31,11 +31,11 @@ export const useServerApiState = create<ServerApiStateProps>()( // Fetch login/SSO behaviour await api - .get(apiUrl(ApiEndpoints.sso_providers), { + .get(apiUrl(ApiEndpoints.securtiy_settings), { headers: { Authorization: '' } }) .then((response) => { - set({ auth_settings: response.data }); + set({ auth_settings: response.data.data }); }) .catch(() => { console.error('ERR: Error fetching SSO information'); diff --git a/src/frontend/src/states/states.tsx b/src/frontend/src/states/states.tsx index e0ca580930..47f0df3de5 100644 --- a/src/frontend/src/states/states.tsx +++ b/src/frontend/src/states/states.tsx @@ -59,6 +59,26 @@ export interface AuthProps { 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 { id: string; name: string;