diff --git a/web/src/views/Settings/TwoFactorAuthentication/TOTPRegisterDialogController.tsx b/web/src/views/Settings/TwoFactorAuthentication/TOTPRegisterDialogController.tsx index 4244676a0..c56ff20bf 100644 --- a/web/src/views/Settings/TwoFactorAuthentication/TOTPRegisterDialogController.tsx +++ b/web/src/views/Settings/TwoFactorAuthentication/TOTPRegisterDialogController.tsx @@ -43,7 +43,7 @@ import { getTOTPOptions } from "@services/UserInfoTOTPConfiguration"; import { State } from "@views/LoginPortal/SecondFactor/OneTimePasswordMethod"; import OTPDial from "@views/LoginPortal/SecondFactor/OTPDial"; -const steps = ["Start", "Scan QR Code", "Confirmation"]; +const steps = ["Start", "Register", "Confirm"]; interface Props { open: boolean; @@ -216,16 +216,18 @@ export default function TOTPRegisterDialogController(props: Props) { const hidePeriods = advanced && optionPeriods.length <= 1; const qrcodeFuzzyStyle = totpIsLoading || hasErrored ? styles.fuzzy : undefined; - function SecretButton(text: string | undefined, action: string, icon: IconDefinition) { + function SecretButton(text: string, action: string, icon: IconDefinition) { + const handleOnClick = (event: React.MouseEvent) => { + (async () => { + event.preventDefault(); + + await navigator.clipboard.writeText(text); + createSuccessNotification(action); + })(); + }; + return ( - { - navigator.clipboard.writeText(`${text}`); - createSuccessNotification(`${action}`); - }} - size="large" - > + ); @@ -341,24 +343,10 @@ export default function TOTPRegisterDialogController(props: Props) { case 1: return ( - - - - {translate("Need Google Authenticator?")} - - - - - + {!hasErrored && totpIsLoading ? ( ) : null} @@ -395,14 +383,13 @@ export default function TOTPRegisterDialogController(props: Props) { ? SecretButton(totpSecretURL, translate("OTP URL copied to clipboard"), faCopy) : null} - + + + + + {translate("Need Google Authenticator?")} + + + + ); case 2: return ( - - - + + + + + ); } } @@ -451,7 +454,7 @@ export default function TOTPRegisterDialogController(props: Props) { - + {renderStep(activeStep)}