Fix HTTP Auth fill (#1869)

Fix HTTP Auth fill
This commit is contained in:
Sami Vänttinen 2023-03-02 15:32:44 +02:00 committed by GitHub
parent b525513819
commit e99edfa6bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 25 deletions

View file

@ -228,6 +228,7 @@ kpxcEvent.messageHandlers = {
'create_new_group': keepass.createNewGroup,
'enable_automatic_reconnect': keepass.enableAutomaticReconnect,
'disable_automatic_reconnect': keepass.disableAutomaticReconnect,
'fill_http_auth': page.fillHttpAuth,
'generate_password': keepass.generatePassword,
'get_color_theme': kpxcEvent.getColorTheme,
'get_connected_database': kpxcEvent.onGetConnectedDatabase,

View file

@ -379,6 +379,17 @@ page.getLoginList = async function(tab) {
return [];
};
page.fillHttpAuth = async function(tab, credentials) {
if (page.tabs[tab.id] && page.tabs[tab.id].loginList.resolve) {
page.tabs[tab.id].loginList.resolve({
authCredentials: {
username: credentials.login,
password: credentials.password
}
});
}
};
// Update context menu for attribute filling
page.updateContextMenu = async function(tab, credentials) {
// Remove any old attribute items

View file

@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "KeePassXC-Browser",
"version": "1.8.5",
"version_name": "1.8.5",
"version": "1.8.5.1",
"version_name": "1.8.5.1",
"description": "__MSG_extensionDescription__",
"author": "KeePassXC Team",
"icons": {

View file

@ -19,16 +19,12 @@
return;
}
if (data.resolve) {
const id = e.target.id;
const creds = data.logins[Number(id)];
data.resolve({
authCredentials: {
username: creds.login,
password: creds.password
}
});
}
const credentials = data.logins[Number(e.target.id)];
browser.runtime.sendMessage({
action: 'fill_http_auth',
args: credentials
});
close();
});
ll.appendChild(a);
@ -47,16 +43,12 @@
});
$('#btn-dismiss').addEventListener('click', async () => {
const loginData = await getLoginData();
// Using reject won't work with every browser. So return empty credentials instead.
if (loginData.resolve) {
loginData.resolve({
authCredentials: {
username: '',
password: ''
}
});
}
// Return empty credentials
browser.runtime.sendMessage({
action: 'fill_http_auth',
args: { login: '', password: '' }
});
close();
});
})();

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "KeePassXC-Browser",
"version": "1.8.5",
"version": "1.8.5.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "KeePassXC-Browser",
"version": "1.8.5",
"version": "1.8.5.1",
"license": "GPL-3.0",
"dependencies": {
"@npmcli/fs": "^2.1.0",

View file

@ -1,6 +1,6 @@
{
"name": "KeePassXC-Browser",
"version": "1.8.5",
"version": "1.8.5.1",
"description": "KeePassXC-Browser",
"main": "build.js",
"devDependencies": {