From 4b88040222c44ee89bc8c98036321cc068837c95 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Wed, 7 Mar 2018 17:13:37 +0100 Subject: [PATCH] [WIP] Add possible french tags for card auto-fill (#540) * Add some possible french tags for card form filling * Remove unused parameter * Revert "Remove unused parameter" This reverts commit 994e16b59c8338af9579d65518983755c854f393. * Add some values to contains check too * Add 'credit-card' check --- src/services/autofill.service.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 873b108cf7..ab734d5061 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -426,29 +426,34 @@ export default class AutofillService implements AutofillServiceInterface { // ref https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill // ref https://developers.google.com/web/fundamentals/design-and-ux/input/forms/ if (!fillFields.cardholderName && this.isFieldMatch(f[attr], - ['cc-name', 'card-name', 'cardholder-name', 'cardholder', 'name'], + ['cc-name', 'card-name', 'cardholder-name', 'cardholder', 'name', 'nom'], ['cc-name', 'card-name', 'cardholder-name', 'cardholder'])) { fillFields.cardholderName = f; } else if (!fillFields.number && this.isFieldMatch(f[attr], - ['cc-number', 'cc-num', 'card-number', 'card-num', 'number', 'cc', 'cc-no', 'card-no'], - ['cc-number', 'cc-num', 'card-number', 'card-num', 'cc-no', 'card-no'])) { + ['cc-number', 'cc-num', 'card-number', 'card-num', 'number', 'cc', 'cc-no', 'card-no', 'credit-card', + 'numero-carte', 'carte', 'carte-credit'], + ['cc-number', 'cc-num', 'card-number', 'card-num', 'cc-no', 'card-no', 'credit-card', + 'carte-credit', 'numero-carte'])) { fillFields.number = f; } else if (!fillFields.exp && this.isFieldMatch(f[attr], - ['cc-exp', 'card-exp', 'cc-expiration', 'card-expiration', 'cc-ex', 'card-ex', 'card-expire'], + ['cc-exp', 'card-exp', 'cc-expiration', 'card-expiration', 'cc-ex', 'card-ex', 'card-expire', + 'validite', 'expiration'], [])) { fillFields.exp = f; } else if (!fillFields.expMonth && this.isFieldMatch(f[attr], ['exp-month', 'cc-exp-month', 'cc-month', 'card-month', 'cc-mo', 'card-mo', 'exp-mo', 'card-exp-mo', 'cc-exp-mo', 'card-expiration-month', 'expiration-month', 'cc-mm', 'cc-m', 'card-mm', 'card-m', 'card-exp-mm', 'cc-exp-mm', 'exp-mm', 'exp-m', - 'expire-month', 'expire-mo', 'card-expire-month', 'card-expire-mo'])) { + 'expire-month', 'expire-mo', 'card-expire-month', 'card-expire-mo', 'mois-validite', + 'mois-expiration', 'm-validite', 'm-expiration'])) { fillFields.expMonth = f; } else if (!fillFields.expYear && this.isFieldMatch(f[attr], ['exp-year', 'cc-exp-year', 'cc-year', 'card-year', 'cc-yr', 'card-yr', 'exp-yr', 'card-exp-yr', 'cc-exp-yr', 'card-expiration-year', 'expiration-year', 'cc-yy', 'cc-y', 'card-yy', 'card-y', 'card-exp-yy', 'cc-exp-yy', 'exp-yy', 'exp-y', 'cc-yyyy', 'card-yyyy', 'card-exp-yyyy', 'cc-exp-yyyy', - 'expire-year', 'expire-yr', 'card-expire-year', 'card-expire-yr'])) { + 'expire-year', 'expire-yr', 'card-expire-year', 'card-expire-yr', 'an-validite', + 'an-expiration', 'annee-validite', 'annee-expiration'])) { fillFields.expYear = f; } else if (!fillFields.code && this.isFieldMatch(f[attr], ['cvv', 'cvc', 'cvv2', 'cc-csc', 'cc-cvv', 'card-csc', 'card-cvv', 'cvd',