mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #1251 from keepassxreboot/fix/protonmail_mailbox_password
Add exception for Protonmail's mailbox password input
This commit is contained in:
commit
65044321e8
2 changed files with 31 additions and 9 deletions
|
|
@ -46,22 +46,29 @@ kpxcSites.googlePasswordFormUrl = 'https://accounts.google.com/signin/v2/challen
|
|||
kpxcSites.googleUrl = 'https://accounts.google.com';
|
||||
kpxcSites.savedForm = undefined;
|
||||
|
||||
// Handles a few exceptions for certain sites where password form is inside a div
|
||||
// or another element that is not detected directly. Triggered by MutationObserver.
|
||||
// Returns true if an Element has a matching classList.
|
||||
kpxcSites.exceptionFound = function(classList) {
|
||||
if (!classList || classList.length === 0) {
|
||||
/**
|
||||
* Handles a few exceptions for certain sites where password form is inside a div
|
||||
* or another element that is not detected directly. Triggered by MutationObserver.
|
||||
* @param {string} identifier Usually a classList or element id
|
||||
* @returns {boolean} True if an Element has a match with the identifier and document location
|
||||
*/
|
||||
kpxcSites.exceptionFound = function(identifier) {
|
||||
if (!identifier || identifier.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (document.location.origin === 'https://idmsa.apple.com'
|
||||
&& [ 'password', 'form-row', 'show-password' ].every(c => classList.contains(c))) {
|
||||
&& [ 'password', 'form-row', 'show-password' ].every(c => identifier.contains(c))) {
|
||||
return true;
|
||||
} else if (document.location.origin.startsWith('https://signin.ebay.')
|
||||
&& classList.contains('null')) {
|
||||
&& identifier.contains('null')) {
|
||||
return true;
|
||||
} else if (document.location.origin.startsWith('https://www.fidelity.com')
|
||||
&& classList.contains('fs-mask-username')) {
|
||||
&& identifier.contains('fs-mask-username')) {
|
||||
return true;
|
||||
} else if (document.location.origin.startsWith('https://app.protonmail.ch')
|
||||
|| document.location.origin.startsWith('https://mail.protonmail.com')
|
||||
&& identifier === 'mailboxPassword') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ kpxcIcons.addIcon = async function(field, iconType) {
|
|||
// Adds all necessary icons to a saved form
|
||||
kpxcIcons.addIconsFromForm = async function(form) {
|
||||
const addUsernameIcons = async function(c) {
|
||||
if (kpxc.settings.showLoginFormIcon && await kpxc.passwordFilled() === false) {
|
||||
if (kpxc.settings.showLoginFormIcon && await kpxc.passwordFilledWithExceptions(c) === false) {
|
||||
// Special case where everything else has been hidden, but a single password field is now displayed.
|
||||
// For example PayPal and Amazon is handled like this.
|
||||
if (c.username && !c.password && c.passwordInputs.length === 1) {
|
||||
|
|
@ -1230,6 +1230,21 @@ kpxc.passwordFilled = async function() {
|
|||
return await sendMessage('password_get_filled');
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle passwordFilled() with possible exceptions, e.g. Protonmail's mailbox password
|
||||
* where we actually need two passwords for a successful login.
|
||||
* If an exception is found, act like password is not yet filled.
|
||||
* @param {Object} currentForm Current saved form. @see kpxcForm.saveForm
|
||||
* @returns {boolean} True if password has been already filled
|
||||
*/
|
||||
kpxc.passwordFilledWithExceptions = async function(currentForm) {
|
||||
if (currentForm.password && kpxcSites.exceptionFound(currentForm.password.id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return await sendMessage('password_get_filled');
|
||||
};
|
||||
|
||||
// Prepares autocomplete and login popup ready for user interaction
|
||||
kpxc.prepareCredentials = async function() {
|
||||
if (kpxc.credentials.length === 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue