Skip to content

Commit

Permalink
fix: twofactor design changes (#1245)
Browse files Browse the repository at this point in the history
* fix: twofactor design changes

* chore: fix i18n

---------

Co-authored-by: HendrikThePendric <hendrik@dhis2.org>
  • Loading branch information
cooper-joe and HendrikThePendric authored Feb 27, 2023
1 parent 6498d73 commit 283d471
Show file tree
Hide file tree
Showing 17 changed files with 244 additions and 138 deletions.
122 changes: 64 additions & 58 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2023-02-23T14:26:05.271Z\n"
"PO-Revision-Date: 2023-02-23T14:26:05.271Z\n"
"POT-Creation-Date: 2023-02-27T14:55:39.217Z\n"
"PO-Revision-Date: 2023-02-27T14:55:39.217Z\n"

msgid "Never"
msgstr "Never"
Expand Down Expand Up @@ -190,86 +190,92 @@ msgstr "Login"
msgid "Failed to update password"
msgstr "Failed to update password"

msgid "2 Factor Authentication"
msgstr "2 Factor Authentication"
msgid "Two-factor Authentication"
msgstr "Two-factor Authentication"

msgid ""
"To disable 2 Factor Authentication for your account, first enter the "
"confirmation code from the Authenticator App and then click \"Disable\"."
msgstr ""
"To disable 2 Factor Authentication for your account, first enter the "
"confirmation code from the Authenticator App and then click \"Disable\"."
msgid "Turn off two-factor authentication"
msgstr "Turn off two-factor authentication"

msgid "Open your authenticator app."
msgstr "Open your authenticator app."

msgid "Now, enter the authentication code below and click the \"Turn off\" button."
msgstr "Now, enter the authentication code below and click the \"Turn off\" button."

msgid "Instructions after disabling 2FA"
msgstr "Instructions after disabling 2FA"
msgid "Remove two-factor account"
msgstr "Remove two-factor account"

msgid ""
"After disabling 2-factor authentication on your account we recommend to "
"also remove the account from the Authenticator App on your phone/tablet, so "
"you don't run into problems if you want to re-enable it in the future."
"Two-factor authentication is now turned off. It is recommended to remove "
"the account from your authenticator app now to prevent any future issues "
"re-enabling two-factor authentication."
msgstr ""
"After disabling 2-factor authentication on your account we recommend to "
"also remove the account from the Authenticator App on your phone/tablet, so "
"you don't run into problems if you want to re-enable it in the future."
"Two-factor authentication is now turned off. It is recommended to remove "
"the account from your authenticator app now to prevent any future issues "
"re-enabling two-factor authentication."

msgid "Play store"
msgstr "Play store"

msgid "App store"
msgstr "App store"

msgid "In the Authenticator App, click the ➕ sign to add a new entry."
msgstr "In the Authenticator App, click the ➕ sign to add a new entry."

msgid "Choose \"Scan a barcode\""
msgstr "Choose \"Scan a barcode\""

msgid "Scan the barcode below"
msgstr "Scan the barcode below"

msgid "Now enter the code from the Authenticator app below and click \"enable\""
msgstr "Now enter the code from the Authenticator app below and click \"enable\""

msgid "Instructions for re-enabling 2-Factor Authentication"
msgstr "Instructions for re-enabling 2-Factor Authentication"
msgid "Turn on two-factor authentication"
msgstr "Turn on two-factor authentication"

msgid ""
"When enabling 2 Factor Authentication, you have to add a new entry to the "
"Authenticator App. If you previously had configured the Authenticator App "
"for this user account you need to remove this entry and create a new one, "
"otherwise two Factor Authentication can not be enabled."
"Make sure you have an authenticator app installed on your device. We "
"recommend Google Authenticator"
msgstr ""
"When enabling 2 Factor Authentication, you have to add a new entry to the "
"Authenticator App. If you previously had configured the Authenticator App "
"for this user account you need to remove this entry and create a new one, "
"otherwise two Factor Authentication can not be enabled."
"Make sure you have an authenticator app installed on your device. We "
"recommend Google Authenticator"

msgid "2 Factor Authentication is currently"
msgstr "2 Factor Authentication is currently"
msgid ""
"Now, enter the code from your authenticator app below and click the \"Turn "
"on\" button."
msgstr ""
"Now, enter the code from your authenticator app below and click the \"Turn "
"on\" button."

msgid "enabled"
msgstr "enabled"
msgid "Already set up two-factor authentication before?"
msgstr "Already set up two-factor authentication before?"

msgid "disabled"
msgstr "disabled"
msgid ""
"If you have set up two-factor authentication for this account before, you "
"need to remove that entry from your authenticator app before setting it up "
"again."
msgstr ""
"If you have set up two-factor authentication for this account before, you "
"need to remove that entry from your authenticator app before setting it up "
"again."

msgid "Could not update 2 Factor authentication status"
msgstr "Could not update 2 Factor authentication status"
msgid ""
"Two-factor authentication protects your account with an extra layer of "
"security. With two-factor authentication turned on, you will need to enter "
"an authentication code from your device every time you log in."
msgstr ""
"Two-factor authentication protects your account with an extra layer of "
"security. With two-factor authentication turned on, you will need to enter "
"an authentication code from your device every time you log in."

msgid "Please enter a 6 digit code"
msgstr "Please enter a 6 digit code"
msgid "Two-factor authentication is on."
msgstr "Two-factor authentication is on."

msgid "2 Factor Authentication code"
msgstr "2 Factor Authentication code"
msgid "Two-factor authentication is off."
msgstr "Two-factor authentication is off."

msgid "XXXXXX"
msgstr "XXXXXX"
msgid "Could not update two-factor authentication"
msgstr "Could not update two-factor authentication"

msgid "Disable"
msgstr "Disable"
msgid ""
"This code does not look right. Enter the six digit code from your "
"authentication app."
msgstr ""
"This code does not look right. Enter the six digit code from your "
"authentication app."

msgid "Enable"
msgstr "Enable"
msgid "Six digit authentication code"
msgstr "Six digit authentication code"

msgid "Could not enable 2 Factor Authentication"
msgstr "Could not enable 2 Factor Authentication"
Expand Down
8 changes: 5 additions & 3 deletions src/account/twoFactor/TwoFactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import styles from './TwoFactor.module.css'
import TwoFactorDisableInstructions from './TwoFactorDisableInstructions.js'
import TwoFactorDisableNoticeBox from './TwoFactorDisableNoticeBox.js'
import TwoFactorEnableInstructions from './TwoFactorEnableInstructions.js'
import TwoFactorEnableNoticeBox from './TwoFactorEnableNoticeBox.js'
import TwoFactorEnableNotice from './TwoFactorEnableNotice.js'
import TwoFactorIntroduction from './TwoFactorIntroduction.js'
import TwoFactorStatus from './TwoFactorStatus.js'
import TwoFactorToggler from './TwoFactorToggler.js'
import useTwoFaToggleMutation from './useTwoFaToggleMutation.js'
Expand All @@ -23,9 +24,10 @@ const TwoFactor = () => {
return (
<div className={cx('content-area', styles.container)}>
<div className={styles.header}>
{i18n.t('2 Factor Authentication')}
{i18n.t('Two-factor Authentication', { keySeparator: '<|>' })}
</div>
<Card className={styles.card}>
<TwoFactorIntroduction />
<TwoFactorStatus isTwoFaEnabled={isTwoFaEnabled} />
{lastActionWasTwoFaDisableSuccess && (
<TwoFactorDisableNoticeBox />
Expand All @@ -42,7 +44,7 @@ const TwoFactor = () => {
loading={loading}
/>
{!isTwoFaEnabled && !lastActionWasTwoFaDisableSuccess && (
<TwoFactorEnableNoticeBox />
<TwoFactorEnableNotice />
)}
</Card>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/account/twoFactor/TwoFactor.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
display: block;
width: auto;
margin-right: 16px;
padding: 16px;
padding: var(--spacers-dp24);
max-width: 960px;
}
height: auto;
}
25 changes: 20 additions & 5 deletions src/account/twoFactor/TwoFactorDisableInstructions.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import styles from './TwoFactorDisableInstructions.module.css'

const TwoFactorDisableInstructions = () => (
<p>
{i18n.t(
'To disable 2 Factor Authentication for your account, first enter the confirmation code from the Authenticator App and then click "Disable".'
)}
</p>
<>
<p className={styles.instructionsHeader}>
{i18n.t('Turn off two-factor authentication', {
keySeparator: '<|>',
})}
</p>
<ol className={styles.orderedList}>
<li>
{i18n.t('Open your authenticator app.', {
keySeparator: '<|>',
})}
</li>
<li>
{i18n.t(
'Now, enter the authentication code below and click the "Turn off" button.'
)}
</li>
</ol>
</>
)

export default TwoFactorDisableInstructions
15 changes: 15 additions & 0 deletions src/account/twoFactor/TwoFactorDisableInstructions.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.instructionsHeader {
font-size: 18px;
font-weight: 500;
color: var(--colors-grey900);
}

.orderedList {
padding-inline-start: 24px;
font-size: 14px;
line-height: 19px;
}

.orderedList li + li {
margin-top: var(--spacers-dp8);
}
7 changes: 4 additions & 3 deletions src/account/twoFactor/TwoFactorDisableNoticeBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import styles from './TwoFactorDisableNoticeBox.module.css'
const TwoFactorDisableNoticeBox = () => (
<NoticeBox
className={styles.container}
info
title={i18n.t('Instructions after disabling 2FA')}
warning
title={i18n.t('Remove two-factor account', { keySeparator: '<|>' })}
>
{i18n.t(
"After disabling 2-factor authentication on your account we recommend to also remove the account from the Authenticator App on your phone/tablet, so you don't run into problems if you want to re-enable it in the future."
'Two-factor authentication is now turned off. It is recommended to remove the account from your authenticator app now to prevent any future issues re-enabling two-factor authentication.',
{ keySeparator: '<|>' }
)}
</NoticeBox>
)
Expand Down
43 changes: 20 additions & 23 deletions src/account/twoFactor/TwoFactorEnableInstructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,37 @@ const QRCode = () => {

const TwoFactorEnableInstructions = () => (
<>
<p className={styles.intro}>
{i18n.t(
'To enable 2 Factor Authentication for your account, follow the following steps:'
)}
<p className={styles.instructionsHeader}>
{i18n.t('Turn on two-factor authentication', {
keySeparator: '<|>',
})}
</p>
<ol className={styles.orderedList}>
<li>
<span>
{i18n.t(
'Ensure you have the Authenticator App installed on you phone or tablet. It is available for download here:'
)}
</span>
<ul className={styles.unOrderedList}>
<li>
<PlayStoreLink />
</li>
<li>
<AppStoreLink />
</li>
</ul>
</li>
<li>
{i18n.t(
'In the Authenticator App, click the ➕ sign to add a new entry.'
'Make sure you have an authenticator app installed on your device. We recommend Google Authenticator'
)}
{' ('}
<span className={styles.downloadLink}>
<PlayStoreLink />
</span>
{', '}
<span className={styles.downloadLink}>
<AppStoreLink />
</span>
{').'}
</li>
<li>{i18n.t('Choose "Scan a barcode"')}</li>
<li>
<span>{i18n.t('Scan the barcode below')}</span>
<span>
{i18n.t(
'Use the authenticator app to scan the QR code below:'
)}
</span>
<QRCode />
</li>
<li>
{i18n.t(
'Now enter the code from the Authenticator app below and click "enable"'
'Now, enter the code from your authenticator app below and click the "Turn on" button.'
)}
</li>
</ol>
Expand Down
17 changes: 13 additions & 4 deletions src/account/twoFactor/TwoFactorEnableInstructions.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@
display: block;
}

.instructionsHeader {
font-size: 18px;
font-weight: 500;
color: var(--colors-grey900);
}

.orderedList {
padding-inline-start: 24px;
line-height: 24px;
font-size: 14px;
line-height: 19px;
}

.unOrderedList {
padding-inline-start: 16px;
line-height: 20px;
.orderedList li + li {
margin-top: var(--spacers-dp8);
}

.downloadLink a {
color: var(--colors-grey900);
}
23 changes: 23 additions & 0 deletions src/account/twoFactor/TwoFactorEnableNotice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import i18n from '@dhis2/d2-i18n'
import { IconQuestion16 } from '@dhis2/ui'
import React from 'react'
import styles from './TwoFactorEnableNotice.module.css'

const TwoFactorEnableNotice = () => (
<div className={styles.enableNoticeContainer}>
<p className={styles.enableNoticeTitle}>
<IconQuestion16 />
{i18n.t('Already set up two-factor authentication before?', {
keySeparator: '<|>',
})}
</p>
<p className={styles.enableNoticeBody}>
{i18n.t(
'If you have set up two-factor authentication for this account before, you need to remove that entry from your authenticator app before setting it up again.',
{ keySeparator: '<|>' }
)}
</p>
</div>
)

export default TwoFactorEnableNotice
Loading

0 comments on commit 283d471

Please sign in to comment.