detech password changes with 2 equal passwords

This commit is contained in:
Kyle Spearrin 2018-09-07 08:01:50 -04:00
parent 768aab2bf8
commit d2e5c9b6ea
2 changed files with 25 additions and 10 deletions

View File

@ -316,10 +316,18 @@ export default class RuntimeBackground {
return;
}
let id: string = null;
const ciphers = await this.cipherService.getAllDecryptedForUrl(changeData.url);
const passwordMatches = ciphers.filter((c) => c.login.password === changeData.currentPassword);
if (passwordMatches.length === 1) {
this.addChangedPasswordToQueue(passwordMatches[0].id, loginDomain, changeData.newPassword, tab);
if (changeData.currentPassword != null) {
const passwordMatches = ciphers.filter((c) => c.login.password === changeData.currentPassword);
if (passwordMatches.length === 1) {
id = passwordMatches[0].id;
}
} else if (ciphers.length === 1) {
id = ciphers[0].id;
}
if (id != null) {
this.addChangedPasswordToQueue(id, loginDomain, changeData.newPassword, tab);
}
}

View File

@ -351,6 +351,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
let curPass: string = null;
let newPass: string = null;
let newPassOnly = false;
if (formData[i].passwordEls.length === 3 && passwords.length === 3) {
newPass = passwords[1];
if (passwords[0] !== newPass && newPass === passwords[2]) {
@ -359,16 +360,22 @@ document.addEventListener('DOMContentLoaded', (event) => {
curPass = passwords[2];
}
} else if (formData[i].passwordEls.length === 2 && passwords.length === 2) {
const buttonText = getButtonText(getSubmitButton(form, changePasswordButtonNames));
const matches = Array.from(changePasswordButtonContainsNames)
.filter((n) => buttonText.indexOf(n) > -1);
if (matches.length > 0) {
curPass = passwords[0];
newPass = passwords[1];
if (passwords[0] === passwords[1]) {
newPassOnly = true;
newPass = passwords[0];
curPass = null;
} else {
const buttonText = getButtonText(getSubmitButton(form, changePasswordButtonNames));
const matches = Array.from(changePasswordButtonContainsNames)
.filter((n) => buttonText.indexOf(n) > -1);
if (matches.length > 0) {
curPass = passwords[0];
newPass = passwords[1];
}
}
}
if (newPass != null && curPass != null) {
if (newPass != null && curPass != null || (newPassOnly && newPass != null)) {
processedForm(form);
sendPlatformMessage({
command: 'bgChangedPassword',