mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #121 from keepassxreboot/http_auth_fixes
HTTP Auth fixes
This commit is contained in:
commit
e2155778c8
6 changed files with 60 additions and 57 deletions
|
|
@ -85,7 +85,7 @@ httpAuth.loginOrShowCredentials = function(logins, details, resolve, reject) {
|
|||
});
|
||||
} else {
|
||||
if (page.settings.showNotifications) {
|
||||
showNotification('Multiple credentials detected. Click on the extension icon to choose the correct one.');
|
||||
showNotification('HTTP authentication with multiple credentials detected. Click on the extension icon to choose the correct one.');
|
||||
}
|
||||
kpxcEvent.onHTTPAuthPopup(null, { 'id': details.tabId }, { 'logins': logins, 'url': details.searchUrl, 'resolve': resolve });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,33 +7,15 @@ body {
|
|||
font-size: 15px;
|
||||
padding: 8px;
|
||||
}
|
||||
.credentials ul {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
list-style-position: inside;
|
||||
.list-group {
|
||||
font-size: .9em !important;
|
||||
}
|
||||
.credentials li {
|
||||
list-style: none;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
margin-left: 10px;
|
||||
margin-right: 5px;
|
||||
.list-group-item {
|
||||
padding: 5px 10px !important;
|
||||
}
|
||||
.credentials a {
|
||||
color: #333;
|
||||
}
|
||||
.credentials a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
.credentials li:hover {
|
||||
.list-group-item:hover {
|
||||
cursor: pointer;
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
.settings {
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@
|
|||
<p>
|
||||
Select the login information you would like to get logged in with:
|
||||
</p>
|
||||
<ul id="login-list"></ul>
|
||||
<div id="login-list" class="list-group"></div>
|
||||
<p>
|
||||
<button id="btn-dismiss" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-remove"></span> Dismiss and show the default authentication dialog</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,37 +1,57 @@
|
|||
'use strict';
|
||||
|
||||
$(function() {
|
||||
browser.runtime.getBackgroundPage().then((global) => {
|
||||
browser.tabs.query({'active': true, 'currentWindow': true}).then((tabs) => {
|
||||
let tab = tabs[0];
|
||||
const data = global.page.tabs[tab.id].loginList;
|
||||
let ul = document.getElementById('login-list');
|
||||
for (let i = 0; i < data.logins.length; i++) {
|
||||
const li = document.createElement('li');
|
||||
const a = document.createElement('a');
|
||||
a.textContent = data.logins[i].login + " (" + data.logins[i].name + ")";
|
||||
li.appendChild(a);
|
||||
$(a).data('creds', data.logins[i]);
|
||||
$(a).click(function () {
|
||||
if (data.resolve) {
|
||||
const creds = $(this).data('creds');
|
||||
data.resolve({
|
||||
authCredentials: {
|
||||
username: creds.login,
|
||||
password: creds.password
|
||||
}
|
||||
});
|
||||
}
|
||||
close();
|
||||
});
|
||||
ul.appendChild(li);
|
||||
}
|
||||
const getLoginData = function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
browser.runtime.getBackgroundPage().then((global) => {
|
||||
browser.tabs.query({'active': true, 'currentWindow': true}).then((tabs) => {
|
||||
resolve(global.page.tabs[tabs[0].id].loginList);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$(function() {
|
||||
getLoginData().then((data) => {
|
||||
let ll = document.getElementById('login-list');
|
||||
for (let i = 0; i < data.logins.length; ++i) {
|
||||
const a = document.createElement('a');
|
||||
a.setAttribute('class', 'list-group-item');
|
||||
a.textContent = data.logins[i].login + " (" + data.logins[i].name + ")";
|
||||
$(a).data('creds', data.logins[i]);
|
||||
$(a).click(function () {
|
||||
if (data.resolve) {
|
||||
const creds = $(this).data('creds');
|
||||
data.resolve({
|
||||
authCredentials: {
|
||||
username: creds.login,
|
||||
password: creds.password
|
||||
}
|
||||
});
|
||||
}
|
||||
close();
|
||||
});
|
||||
ll.appendChild(a);
|
||||
}
|
||||
});
|
||||
|
||||
$('#lock-database-button').click(function() {
|
||||
browser.runtime.sendMessage({
|
||||
action: 'lock-database'
|
||||
}).then(status_response);
|
||||
});
|
||||
|
||||
$('#btn-dismiss').click(function() {
|
||||
getLoginData().then((data) => {
|
||||
// Using reject won't work with every browser. So return empty credentials instead.
|
||||
if (data.resolve) {
|
||||
data.resolve({
|
||||
authCredentials: {
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
});
|
||||
}
|
||||
close();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<p>
|
||||
Select the login information you would like to get entered into the page:
|
||||
</p>
|
||||
<ul id="login-list"></ul>
|
||||
<div id="login-list" class="list-group"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -9,13 +9,11 @@ $(function() {
|
|||
const tab = tabs[0];
|
||||
|
||||
const logins = global.page.tabs[tab.id].loginList;
|
||||
let ul = document.getElementById('login-list');
|
||||
let ll = document.getElementById('login-list');
|
||||
for (let i = 0; i < logins.length; i++) {
|
||||
const li = document.createElement('li');
|
||||
const a = document.createElement('a');
|
||||
a.textContent = logins[i];
|
||||
li.setAttribute('class', 'list-group-item');
|
||||
li.appendChild(a);
|
||||
a.setAttribute('class', 'list-group-item');
|
||||
a.setAttribute('id', '' + i);
|
||||
a.addEventListener('click', (e) => {
|
||||
const id = e.target.id;
|
||||
|
|
@ -25,7 +23,7 @@ $(function() {
|
|||
});
|
||||
close();
|
||||
});
|
||||
ul.appendChild(li);
|
||||
ll.appendChild(a);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue