feat(totp): scanner le QR 2FA affiche a l'ecran (capture + ZXing), seul un otpauth:// part vers la page

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-09-18 22:24:35 +01:00
parent 508d5345bf
commit 72f9acd733
7 changed files with 182 additions and 1 deletions
+18
View File
@@ -4833,6 +4833,24 @@ function soTotpField(plainSecret) {
});
row.appendChild(input);
row.appendChild(toggle);
// Lit le QR qu'affiche le site a l'activation de la 2FA : l'exe s'efface,
// capture l'ecran et ne renvoie qu'un lien otpauth:// (qr/screen).
if (Bridge.active) {
const scan = el('button', { class: 'icon-btn icon-btn-sm', type: 'button', title: 'Scan the 2FA QR code shown on screen' });
scan.appendChild(icon('i-qr'));
scan.addEventListener('click', () => {
Bridge.onScreenQr = (text) => {
const secret = parseOtpAuthUri(text || '');
if (!secret) { toast('No 2FA QR code found on screen', 'warning'); return; }
input.value = secret;
updateTotpDisplay();
soDirtyCheck();
toast('2FA secret read from the QR code');
};
window.location.href = 'cmd://qr/screen';
});
row.appendChild(scan);
}
row.appendChild(clear);
wrap.appendChild(row);