Skip to content

Commit

Permalink
Display the account status screen behind the modal
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwoodnz committed May 9, 2023
1 parent 5bcde05 commit a82b109
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions settings/src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,47 +130,50 @@ function Main( { userId } ) {
return <Spinner />;
}

let screenContent;
let screenContent = (
<Card>
<CardHeader className="wporg-2fa__navigation" size="xSmall">
<ScreenLink
screen="account-status"
ariaLabel="Back to the account status page"
anchorText={
<>
<Icon icon={ chevronLeft } />
Back
</>
}
/>

<h3>
{ screen.replace( '-', ' ' ).replace( 'totp', 'Two-Factor Authentication' ) }
</h3>
</CardHeader>

<CardBody className={ 'wporg-2fa__' + screen }>
<CurrentScreen />
</CardBody>
</Card>
);

if ( 'account-status' === screen ) {
screenContent = (
<div className={ 'wporg-2fa__' + screen }>
<div className={ 'wporg-2fa__account-status' }>
<AccountStatus />
</div>
);
} else if (
twoFactorRequiredScreens.includes( screen ) &&
userRecord.record[ '2fa_available_providers' ] &&
userRecord.record[ '2fa_revalidation' ] &&
userRecord.record[ '2fa_revalidation' ].expires_at <= new Date().getTime() / 1000
userRecord.record[ '2fa_revalidation' ].expires_at <= new Date().getTime() / 10
) {
screenContent = <RevalidateModal />;
} else {
screenContent = (
<Card>
<CardHeader className="wporg-2fa__navigation" size="xSmall">
<ScreenLink
screen="account-status"
ariaLabel="Back to the account status page"
anchorText={
<>
<Icon icon={ chevronLeft } />
Back
</>
}
/>

<h3>
{ screen
.replace( '-', ' ' )
.replace( 'totp', 'Two-Factor Authentication' ) }
</h3>
</CardHeader>

<CardBody className={ 'wporg-2fa__' + screen }>
<CurrentScreen />
</CardBody>
</Card>
<>
<div className={ 'wporg-2fa__account-status' }>
<AccountStatus />
</div>
<RevalidateModal />
</>
);
}

Expand Down

0 comments on commit a82b109

Please sign in to comment.