mirror of
https://github.com/bitwarden/browser
synced 2025-01-09 08:56:05 +01:00
autofill card expiration
This commit is contained in:
parent
cd878c75b2
commit
f4e72aae8a
@ -195,6 +195,14 @@ angular
|
||||
}
|
||||
});
|
||||
|
||||
$scope.formatYear = function (year) {
|
||||
if (year.length == 2) {
|
||||
return '20' + year;
|
||||
}
|
||||
|
||||
return year;
|
||||
};
|
||||
|
||||
function totpUpdateCode() {
|
||||
if ($scope.cipher.type !== constantsService.cipherType.login || !$scope.cipher.login.totp) {
|
||||
return;
|
||||
|
@ -111,7 +111,9 @@
|
||||
</div>
|
||||
<div class="list-section-item" ng-if="cipher.card.expMonth || cipher.card.expYear">
|
||||
<span class="item-label">{{i18n.expiration}}</span>
|
||||
{{cipher.card.expMonth ? ('0' + cipher.card.expMonth).slice(-2) : '-'}}/{{cipher.card.expYear || '-'}}
|
||||
{{cipher.card.expMonth ? ('0' + cipher.card.expMonth).slice(-2) : '__'}}
|
||||
/
|
||||
{{cipher.card.expYear ? formatYear(cipher.card.expYear) : '____'}}
|
||||
</div>
|
||||
<div class="list-section-item" ng-if="cipher.card.code">
|
||||
<div class="action-buttons">
|
||||
|
@ -365,6 +365,12 @@ function initAutofill() {
|
||||
fillFields.number = f;
|
||||
}
|
||||
break;
|
||||
case 'cc-exp': case 'ccexp': case 'cardexp': case 'card-exp': case 'cc-expiration':
|
||||
case 'ccexpiration': case 'card-expiration': case 'cardexpiration':
|
||||
if (!fillFields.exp) {
|
||||
fillFields.exp = f;
|
||||
}
|
||||
break;
|
||||
case 'exp-month': case 'expmonth': case 'ccexpmonth': case 'cc-exp-month': case 'cc-month':
|
||||
case 'ccmonth': case 'card-month': case 'cardmonth':
|
||||
if (!fillFields.expMonth) {
|
||||
@ -395,12 +401,25 @@ function initAutofill() {
|
||||
}
|
||||
}
|
||||
|
||||
makeScriptAction(fillScript, options.cipher.card, fillFields, filledFields, 'cardholderName');
|
||||
makeScriptAction(fillScript, options.cipher.card, fillFields, filledFields, 'number');
|
||||
makeScriptAction(fillScript, options.cipher.card, fillFields, filledFields, 'expMonth');
|
||||
makeScriptAction(fillScript, options.cipher.card, fillFields, filledFields, 'expYear');
|
||||
makeScriptAction(fillScript, options.cipher.card, fillFields, filledFields, 'code');
|
||||
makeScriptAction(fillScript, options.cipher.card, fillFields, filledFields, 'brand');
|
||||
var card = options.cipher.card;
|
||||
makeScriptAction(fillScript, card, fillFields, filledFields, 'cardholderName');
|
||||
makeScriptAction(fillScript, card, fillFields, filledFields, 'number');
|
||||
makeScriptAction(fillScript, card, fillFields, filledFields, 'expMonth');
|
||||
makeScriptAction(fillScript, card, fillFields, filledFields, 'expYear');
|
||||
makeScriptAction(fillScript, card, fillFields, filledFields, 'code');
|
||||
makeScriptAction(fillScript, card, fillFields, filledFields, 'brand');
|
||||
|
||||
if (fillFields.exp && card.expMonth && card.expYear) {
|
||||
var year = card.expYear;
|
||||
if (year.length == 2) {
|
||||
year = '20' + year;
|
||||
}
|
||||
var exp = year + '-' + ('0' + card.expMonth).slice(-2);
|
||||
|
||||
filledFields[fillFields.exp.opid] = fillFields.exp;
|
||||
fillScript.script.push(['click_on_opid', fillFields.exp.opid]);
|
||||
fillScript.script.push(['fill_by_opid', fillFields.exp.opid, exp]);
|
||||
}
|
||||
|
||||
return fillScript;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user