Skip to content

Commit

Permalink
Add userTrustedDeviceComponent to Account props (#49338)
Browse files Browse the repository at this point in the history
This enables us to add a user trusted device component to be rendered
only in enterprise clusters
  • Loading branch information
avatus authored Nov 25, 2024
1 parent 9215096 commit 2132b97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions web/packages/teleport/src/Account/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ export interface EnterpriseComponentProps {

export interface AccountPageProps {
enterpriseComponent?: React.ComponentType<EnterpriseComponentProps>;
userTrustedDevicesComponent?: React.ComponentType;
}

export function AccountPage({ enterpriseComponent }: AccountPageProps) {
export function AccountPage({
enterpriseComponent,
userTrustedDevicesComponent,
}: AccountPageProps) {
const ctx = useTeleport();
const storeUser = useStore(ctx.storeUser);
const isSso = storeUser.isSso();
Expand All @@ -85,6 +89,7 @@ export function AccountPage({ enterpriseComponent }: AccountPageProps) {
passwordState={storeUser.getPasswordState()}
{...manageDevicesState}
enterpriseComponent={enterpriseComponent}
userTrustedDevicesComponent={userTrustedDevicesComponent}
onPasswordChange={onPasswordChange}
/>
);
Expand Down Expand Up @@ -116,6 +121,7 @@ export function Account({
canAddPasskeys,
enterpriseComponent: EnterpriseComponent,
newDeviceUsage,
userTrustedDevicesComponent: TrustedDeviceListComponent,
passwordState,
onPasswordChange: onPasswordChangeCb,
}: AccountProps) {
Expand Down Expand Up @@ -191,7 +197,7 @@ export function Account({

return (
<Relative>
<FeatureBox>
<FeatureBox maxWidth={1440} margin="auto">
<FeatureHeader>
<FeatureHeaderTitle>Account Settings</FeatureHeaderTitle>
</FeatureHeader>
Expand Down Expand Up @@ -264,6 +270,7 @@ export function Account({
{EnterpriseComponent && (
<EnterpriseComponent addNotification={addNotification} />
)}
{TrustedDeviceListComponent && <TrustedDeviceListComponent />}
</Flex>
</FeatureBox>

Expand Down
1 change: 1 addition & 0 deletions web/packages/teleport/src/DeviceTrust/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type TrustedDevice = {
osType: TrustedDeviceOSType;
enrollStatus: 'enrolled' | 'not enrolled';
owner: string;
createTime?: Date;
};

export type TrustedDeviceOSType = 'Windows' | 'Linux' | 'macOS';
Expand Down

0 comments on commit 2132b97

Please sign in to comment.