1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-22458] Ensure TOTP check ignores email or username fields (#16535)

* [PM-22458] Ensure TOTP check ignores email or username fields

* Resolve underlying totp error for shein.com Germany

* Remove a guard check and add an optional chain
This commit is contained in:
Jeffrey Holland
2025-09-29 17:09:41 +02:00
committed by GitHub
parent 3da89ee4e3
commit f9056b2711

View File

@@ -972,7 +972,7 @@ export default class AutofillService implements AutofillServiceInterface {
fillScript.autosubmit = Array.from(formElementsSet);
}
if (options.allowTotpAutofill) {
if (options.allowTotpAutofill && login?.totp) {
await Promise.all(
totps.map(async (t, i) => {
if (Object.prototype.hasOwnProperty.call(filledFields, t.opid)) {
@@ -980,10 +980,10 @@ export default class AutofillService implements AutofillServiceInterface {
}
filledFields[t.opid] = t;
const totpResponse = await firstValueFrom(
this.totpService.getCode$(options.cipher.login.totp),
);
const totpResponse = await firstValueFrom(this.totpService.getCode$(login.totp));
let totpValue = totpResponse.code;
if (totpValue.length == totps.length) {
totpValue = totpValue.charAt(i);
}