Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions dist/autofill-debug.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions dist/autofill.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Form/FormAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ class FormAnalyzer {
shouldFlip = false;
}
this.updateSignal({ string, strength, signalType: `external link: ${string}`, shouldFlip });
} else if (el.matches(this.matching.cssSelector('enabledCheckboxSelector')) && this.isPersistentSigninText(string)) {
this.decreaseSignalBy(3, 'checkbox: persistent sign-in');
} else {
// any other case
const isH1Element = el.tagName === 'H1';
Expand Down Expand Up @@ -384,6 +386,15 @@ class FormAnalyzer {
this._isCCForm = Boolean(textMatches && deDupedMatches.size > 1);
return this._isCCForm;
}

/**
* Checks if the text is a persistent sign-in text, e.g "stay signed in" or "remember me"
* @param {string} text
* @returns {boolean}
*/
isPersistentSigninText(text) {
return safeRegexTest(/stay.?signed.?in|remember.?me/i, text);
}
}

export default FormAnalyzer;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Form/matching-config/selectors-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ button:not([role=switch]):not([role=link]),
a[href="#"][id*=button i],
a[href="#"][id*=btn i]`;

const enabledCheckboxSelector = 'input[type="checkbox"]:not([disabled])';

const safeUniversalSelector = '*:not(select):not(option):not(script):not(noscript):not(style):not(br)';

const emailAddress = [
Expand Down Expand Up @@ -279,6 +281,7 @@ const selectors = {
formInputsSelectorWithoutSelect,
formInputsSelector,
safeUniversalSelector,
enabledCheckboxSelector,

// Credentials
emailAddress,
Expand Down
7 changes: 7 additions & 0 deletions src/autofill-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ const getTextShallow = (el) => {
if (el.type === 'image') {
return removeExcessWhitespace(el.alt || el.value || el.title || el.name);
}

// If it's checkbox, check for the first label to keep it simple.
// If there are multiple ones, we want to be on the safe side and ignore them,
// as the text can be noisy, resulting in false positives on the caller side.
if (el.type === 'checkbox' && el.labels?.length === 1) {
return removeExcessWhitespace(el.labels[0].textContent);
}
}

let text = '';
Expand Down
Loading
Loading