1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00

autofill exp year when it is a select list

This commit is contained in:
Kyle Spearrin
2019-01-29 09:32:20 -05:00
parent bbad22244c
commit d69862c46d
2 changed files with 18 additions and 2 deletions

2
jslib

Submodule jslib updated: b01709240e...9e97b1e656

View File

@@ -509,7 +509,23 @@ export default class AutofillService implements AutofillServiceInterface {
if (fillFields.expYear && this.hasValue(card.expYear)) { if (fillFields.expYear && this.hasValue(card.expYear)) {
let expYear: string = card.expYear; let expYear: string = card.expYear;
if (this.fieldAttrsContain(fillFields.expYear, 'yyyy') || fillFields.expYear.maxLength === 4) { if (fillFields.expYear.selectInfo && fillFields.expYear.selectInfo.options) {
for (let i = 0; i < fillFields.expYear.selectInfo.options.length; i++) {
const o: [string, string] = fillFields.expYear.selectInfo.options[i];
if (o[0] === card.expYear) {
expYear = o[1];
break;
}
const colonIndex = o[1].indexOf(':');
if (colonIndex > -1 && o[1].length > colonIndex + 1) {
const val = o[1].substring(colonIndex + 2);
if (val != null && val.trim() !== '' && val === card.expYear) {
expYear = o[1];
break;
}
}
}
} else if (this.fieldAttrsContain(fillFields.expYear, 'yyyy') || fillFields.expYear.maxLength === 4) {
if (expYear.length === 2) { if (expYear.length === 2) {
expYear = '20' + expYear; expYear = '20' + expYear;
} }