From 690e175b1d70a0a39b97f285043337f98fffaa80 Mon Sep 17 00:00:00 2001 From: Florian Lang <144521337+FlorianLang06@users.noreply.github.com> Date: Wed, 30 Oct 2024 20:09:33 +0100 Subject: [PATCH] fix: totp autofill fill single digits if one field per digit exist (#11630) --- apps/browser/src/autofill/services/autofill.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/browser/src/autofill/services/autofill.service.ts b/apps/browser/src/autofill/services/autofill.service.ts index 1ff2341d9f8..696bdb8b896 100644 --- a/apps/browser/src/autofill/services/autofill.service.ts +++ b/apps/browser/src/autofill/services/autofill.service.ts @@ -940,13 +940,16 @@ export default class AutofillService implements AutofillServiceInterface { if (options.allowTotpAutofill) { await Promise.all( - totps.map(async (t) => { + totps.map(async (t, i) => { if (Object.prototype.hasOwnProperty.call(filledFields, t.opid)) { return; } filledFields[t.opid] = t; - const totpValue = await this.totpService.getCode(login.totp); + let totpValue = await this.totpService.getCode(login.totp); + if (totpValue.length == totps.length) { + totpValue = totpValue.charAt(i); + } AutofillService.fillByOpid(fillScript, t, totpValue); }), );