Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/interfaces/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface Account {
auto_update_version: string;
auto_update_always: boolean;
local_auth_disabled?: boolean;
local_mfa_enabled?: boolean;
};
onboarding?: AccountOnboarding;
}
Expand Down
39 changes: 39 additions & 0 deletions src/modules/settings/AuthenticationTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { cn } from "@utils/helpers";
import {
CalendarClock,
ExternalLinkIcon,
KeyRound,
ShieldIcon,
ShieldUserIcon,
TimerResetIcon,
Expand Down Expand Up @@ -66,6 +67,15 @@ export default function AuthenticationTab({ account }: Readonly<Props>) {
},
);

// Local MFA (UI only, not wired to the backend yet)
const [isLocalMFAEnabled, setIsLocalMFAEnabled] = useState<boolean>(() => {
try {
return account?.settings?.local_mfa_enabled || false;
} catch (error) {
return false;
}
});

// Peer Expiration
const [
loginExpiration,
Expand Down Expand Up @@ -105,6 +115,7 @@ export default function AuthenticationTab({ account }: Readonly<Props>) {
peerInactivityExpirationEnabled,
peerInactivityExpiresIn,
peerInactivityExpireInterval,
isLocalMFAEnabled,
]);

const saveChanges = async () => {
Expand All @@ -129,6 +140,7 @@ export default function AuthenticationTab({ account }: Readonly<Props>) {
peer_approval_enabled: peerApproval,
user_approval_required: userApprovalRequired,
},
local_mfa_enabled: isLocalMFAEnabled
},
} as Account)
.then(() => {
Expand Down Expand Up @@ -213,6 +225,33 @@ export default function AuthenticationTab({ account }: Readonly<Props>) {
/>
</div>

{account.settings.local_auth_disabled || !account.settings.embedded_idp_enabled ?
(
<div className={"flex flex-col"}>
<FancyToggleSwitch
value={isLocalMFAEnabled}
onChange={setIsLocalMFAEnabled}
dataCy={"local-mfa-enabled"}
label={
<>
<KeyRound size={15} />
Enable Local MFA
</>
}
helpText={
<>
Require multi-factor authentication for users
<br />
authenticating with local credentials.
</>
}
disabled={!permission.settings.update}
/>
</div>
) : null
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated


<div className={"flex flex-col"}>
<FancyToggleSwitch
value={loginExpiration}
Expand Down
Loading