Show raw secret during two-factor setup (#775)
This commit is contained in:
parent
515c548acd
commit
97cb7bdc83
1 changed files with 10 additions and 4 deletions
|
@ -28,7 +28,8 @@ enum SetupStep {
|
||||||
|
|
||||||
const setupDescriptions = {
|
const setupDescriptions = {
|
||||||
[SetupStep.ConfirmPassword]: "Confirm your current password to get started.",
|
[SetupStep.ConfirmPassword]: "Confirm your current password to get started.",
|
||||||
[SetupStep.DisplayQrCode]: "Scan the image below with the authenticator app on your phone.",
|
[SetupStep.DisplayQrCode]:
|
||||||
|
"Scan the image below with the authenticator app on your phone or manually enter the text code instead.",
|
||||||
[SetupStep.EnterTotpCode]: "Enter the six-digit code from your authenticator app below.",
|
[SetupStep.EnterTotpCode]: "Enter the six-digit code from your authenticator app below.",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ const EnableTwoFactorModal = ({ onEnable, onCancel }: EnableTwoFactorModalProps)
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [totpCode, setTotpCode] = useState("");
|
const [totpCode, setTotpCode] = useState("");
|
||||||
const [dataUri, setDataUri] = useState("");
|
const [dataUri, setDataUri] = useState("");
|
||||||
|
const [secret, setSecret] = useState("");
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||||
|
|
||||||
|
@ -68,6 +70,7 @@ const EnableTwoFactorModal = ({ onEnable, onCancel }: EnableTwoFactorModalProps)
|
||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
setDataUri(body.dataUri);
|
setDataUri(body.dataUri);
|
||||||
|
setSecret(body.secret);
|
||||||
setStep(SetupStep.DisplayQrCode);
|
setStep(SetupStep.DisplayQrCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -148,9 +151,12 @@ const EnableTwoFactorModal = ({ onEnable, onCancel }: EnableTwoFactorModalProps)
|
||||||
</form>
|
</form>
|
||||||
</WithStep>
|
</WithStep>
|
||||||
<WithStep step={SetupStep.DisplayQrCode} current={step}>
|
<WithStep step={SetupStep.DisplayQrCode} current={step}>
|
||||||
|
<>
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
<img src={dataUri} />
|
<img src={dataUri} />
|
||||||
</div>
|
</div>
|
||||||
|
<p className="text-center text-xs font-mono">{secret}</p>
|
||||||
|
</>
|
||||||
</WithStep>
|
</WithStep>
|
||||||
<WithStep step={SetupStep.EnterTotpCode} current={step}>
|
<WithStep step={SetupStep.EnterTotpCode} current={step}>
|
||||||
<form onSubmit={handleEnable}>
|
<form onSubmit={handleEnable}>
|
||||||
|
|
Loading…
Reference in a new issue