show 2fa secret as text also (example: adding to bitwarden)

This commit is contained in:
2025-09-10 07:12:05 +03:00
parent 0328e518b6
commit 96f82444a7

View File

@@ -265,11 +265,13 @@ function FactorQrCode({
z.object({
factorName: z.string().min(1),
qrCode: z.string().min(1),
totpSecret: z.string().min(1),
}),
),
defaultValues: {
factorName: '',
qrCode: '',
totpSecret: '',
},
});
@@ -319,6 +321,7 @@ function FactorQrCode({
if (data.type === 'totp') {
form.setValue('factorName', name);
form.setValue('qrCode', data.totp.qr_code);
form.setValue('totpSecret', data.totp.secret);
}
// dispatch event to set factor ID
@@ -343,6 +346,10 @@ function FactorQrCode({
<div className={'flex justify-center'}>
<QrImage src={form.getValues('qrCode')} />
</div>
<p className='text-center text-sm'>
{form.getValues('totpSecret')}
</p>
</div>
);
}