From 325ff31aa6a58232968e228f6142647ce84d1a63 Mon Sep 17 00:00:00 2001
From: Adam Wood <1017872+adamwoodnz@users.noreply.github.com>
Date: Wed, 14 Aug 2024 13:31:13 +1200
Subject: [PATCH] Require explicit action to create backup codes
---
settings/src/components/backup-codes.js | 37 ++++++++++---------------
1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/settings/src/components/backup-codes.js b/settings/src/components/backup-codes.js
index fc361d6f..fd850a21 100644
--- a/settings/src/components/backup-codes.js
+++ b/settings/src/components/backup-codes.js
@@ -21,8 +21,7 @@ import DownloadButton from './download-button';
*/
export default function BackupCodes() {
const {
- user: { backupCodesEnabled, hasPrimaryProvider, backupCodesRemaining },
- backupCodesVerified,
+ user: { hasPrimaryProvider },
} = useContext( GlobalContext );
const [ regenerating, setRegenerating ] = useState( false );
@@ -41,12 +40,7 @@ export default function BackupCodes() {
);
}
- if (
- ! backupCodesEnabled ||
- backupCodesRemaining === 0 ||
- regenerating ||
- ! backupCodesVerified
- ) {
+ if ( regenerating ) {
return
- Backup codes let you access your account if your primary two-factor - authentication method is unavailable, like if your phone is lost or stolen. Each - code can only be used once. -
+Please print the codes and keep them in a safe place.
+ Backup codes let you access your account if your primary two-factor authentication method is + unavailable, like if your phone is lost or stolen. Each code can only be used once. +
+); + /** * Render the screen where users can manage Backup Codes. * @@ -209,25 +206,21 @@ function CodeList( { codes } ) { */ function Manage( { setRegenerating } ) { const { - user: { backupCodesRemaining }, + user: { backupCodesEnabled, backupCodesRemaining }, } = useContext( GlobalContext ); return ( <>- Backup codes let you access your account if your primary two-factor - authentication method is unavailable, like if your phone is lost or stolen. Each - code can only be used once. -
+You have { backupCodesRemaining } backup codes remaining.
) } - { backupCodesRemaining <= 5 && ( + { backupCodesEnabled && backupCodesRemaining <= 5 && (