"Fixed showing credentials from previous logins in the popup (credits to smorks)

This commit is contained in:
varjolintu 2017-09-08 08:30:20 +03:00
parent b1135c232d
commit 481cc286ff
4 changed files with 37 additions and 25 deletions

View file

@ -1,8 +1,9 @@
0.3.0 (2017-??-??)
=========================
- Added Mozilla's browser-polyfill
- Merged changes from the latest passifox (credits to smorks):
- Merged changes from the latest passifox (credits to smorks)
- HTTP auth works with all browsers
- Fixed showing credentials from previous login in popup (credits to smorks)
- TODO: Automatic detectal of div's with forms that are non-hidden by user interaction
0.2.9 (2017-08-27)

View file

@ -233,6 +233,10 @@ event.onMultipleFieldsPopup = function(callback, tab) {
browserAction.show(null, tab);
}
event.onPageClearLogins = function(callback, tab) {
page.clearLogins(tab.id);
callback();
}
// all methods named in this object have to be declared BEFORE this!
event.messageHandlers = {
@ -246,6 +250,7 @@ event.messageHandlers = {
'get_tab_information': event.onGetTabInformation,
'load_keyring': event.onLoadKeyRing,
'load_settings': event.onLoadSettings,
'page_clear_logins': event.onPageClearLogins,
'pop_stack': event.onPopStack,
'popup_login': event.onLoginPopup,
'popup_multiple-fields': event.onMultipleFieldsPopup,

View file

@ -91,7 +91,7 @@ page.clearCredentials = function(tabId, complete) {
delete page.tabs[tabId].credentials;
if (complete) {
page.tabs[tabId].loginList = [];
page.clearLogins(tabId);
browser.tabs.sendMessage(tabId, {
action: 'clear_credentials'
@ -99,6 +99,10 @@ page.clearCredentials = function(tabId, complete) {
}
}
page.clearLogins = function(tabId) {
page.tabs[tabId].loginList = [];
}
page.createTabEntry = function(tabId) {
//console.log('page.createTabEntry('+tabId+')');
page.tabs[tabId] = {

View file

@ -1115,32 +1115,34 @@ cip.initCredentialFields = function(forceCall) {
}
_called.initCredentialFields = true;
const inputs = cipFields.getAllFields();
cipFields.prepareVisibleFieldsWithID('select');
cip.initPasswordGenerator(inputs);
browser.runtime.sendMessage({ 'action': 'page_clear_logins' }).then(() => {
const inputs = cipFields.getAllFields();
cipFields.prepareVisibleFieldsWithID('select');
cip.initPasswordGenerator(inputs);
if (!cipFields.useDefinedCredentialFields()) {
// get all combinations of username + password fields
cipFields.combinations = cipFields.getAllCombinations(inputs);
}
cipFields.prepareCombinations(cipFields.combinations);
if (!cipFields.useDefinedCredentialFields()) {
// get all combinations of username + password fields
cipFields.combinations = cipFields.getAllCombinations(inputs);
}
cipFields.prepareCombinations(cipFields.combinations);
if (cipFields.combinations.length === 0) {
browser.runtime.sendMessage({
action: 'show_default_browseraction'
});
return;
}
if (cipFields.combinations.length === 0) {
browser.runtime.sendMessage({
action: 'show_default_browseraction'
});
return;
}
cip.url = document.location.origin;
cip.submitUrl = cip.getFormActionUrl(cipFields.combinations[0]);
cip.url = document.location.origin;
cip.submitUrl = cip.getFormActionUrl(cipFields.combinations[0]);
if (cip.settings.autoRetrieveCredentials) {
browser.runtime.sendMessage({
action: 'retrieve_credentials',
args: [ cip.url, cip.submitUrl ]
}).then(cip.retrieveCredentialsCallback);
}
if (cip.settings.autoRetrieveCredentials) {
browser.runtime.sendMessage({
action: 'retrieve_credentials',
args: [ cip.url, cip.submitUrl ]
}).then(cip.retrieveCredentialsCallback);
}
});
} // end function init
cip.initPasswordGenerator = function(inputs) {
@ -1694,4 +1696,4 @@ cipEvents.triggerActivatedTab = function() {
args: [ cip.url, cip.submitUrl ]
}).then(cip.retrieveCredentialsCallback);
}
}
}