Skip to content

Commit

Permalink
Improve demo accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBartusek committed Dec 30, 2023
1 parent 9ea592b commit 929ff38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
8 changes: 2 additions & 6 deletions src/client/components/AccountTab/AccountTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import DemoInfo from '../DemoInfo/DemoInfo';
import SecurityOptions from '../SecurityOptions/SecurityOptions';

export default function AccountTab() {
const [ user ] = useContext(UserContext);

return (
<div className='d-flex flex-column'>
<SettingsRow
title="Password and Authentication"
>
{!user.isDemo ? <SecurityOptions /> : <DemoInfo />}
<SecurityOptions />
</SettingsRow>
<SettingsRow
title="Log Out"
Expand All @@ -28,9 +26,7 @@ export default function AccountTab() {
title="Account Removal"
description="Permanently delete this DokChat account. This action is not reversible."
>
{!user.isDemo
? <DeleteAccountButton size='sm' />
: <DemoInfo />}
<DeleteAccountButton size='sm' />
</SettingsRow>
</div>
);
Expand Down
23 changes: 14 additions & 9 deletions src/client/components/SecurityOptions/SecurityOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ export default function SecurityOptions() {

return (
<>
{!user.hasPassword && (
<p className='small text-danger mb-2'>
<BsUnlockFill className='me-1' /> This account has been created using 3rd-party Login Provider. Please create
{!user.isDemo && (
<>
{!user.hasPassword && (
<p className='small text-danger mb-2'>
<BsUnlockFill className='me-1' /> This account has been created using 3rd-party Login Provider. Please create
a password for this account.
</p>
</p>
)}
<Link to='password'>
<InteractiveButton variant='primary' size='sm' icon={BsShieldLock}>
{user.hasPassword ? 'Change' : 'Set'} Password
</InteractiveButton>
</Link>
</>
)}
<Link to='password'>
<InteractiveButton variant='primary' size='sm' icon={BsShieldLock}>
{user.hasPassword ? 'Change' : 'Set'} Password
</InteractiveButton>
</Link>

<p className={`small fw-bold mt-4 mb-2 ${user.is2FAEnabled ? 'text-success' : 'text-danger'}`}>
{user.is2FAEnabled ? <BsLockFill className='me-1' /> : <BsUnlockFill className='me-1' />}
Two-factor authentication {user.is2FAEnabled ? 'enabled' : 'disabled'}
Expand Down

0 comments on commit 929ff38

Please sign in to comment.