mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Centralizes the window popup for multiple credentials HTTP authentication, also better UI if have a lot of credentials
This commit is contained in:
parent
44cefe0ce8
commit
65a13e3dcb
3 changed files with 19 additions and 5 deletions
|
|
@ -179,10 +179,15 @@ kpxcEvent.onHTTPAuthPopup = async function(tab, data) {
|
|||
page.tabs[tab.id].loginList = data;
|
||||
browserAction.show(tab);
|
||||
|
||||
const tabinfo = await browser.tabs.get(tab.id);
|
||||
const windowinfo = await browser.windows.get(tabinfo.windowId);
|
||||
|
||||
const width = 480;
|
||||
const height = 250;
|
||||
const dialogData = {
|
||||
width: 480, height: 250,
|
||||
left: (window.screen.width/2) - (480/2),
|
||||
top: (window.screen.height/2) - (250/2)
|
||||
width: width, height: height,
|
||||
left: Math.round(windowinfo.left + ((windowinfo.width/2) - (width/2))),
|
||||
top: Math.round(windowinfo.top + ((windowinfo.height/2) - (height/2)))
|
||||
};
|
||||
|
||||
const httpAuthDialog = page.tabs[tab.id].httpAuthDialog;
|
||||
|
|
@ -192,11 +197,15 @@ kpxcEvent.onHTTPAuthPopup = async function(tab, data) {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
dialogData.type = "popup";
|
||||
dialogData.type = 'popup';
|
||||
dialogData.url = `/popups/popup_httpauth.html?tab=${tab.id}`;
|
||||
dialogData.titlePreface = `${data.details.realm} (${data.details.challenger.host}) - `;
|
||||
const wnd = await browser.windows.create(dialogData);
|
||||
page.tabs[tab.id].httpAuthDialog = wnd.id;
|
||||
|
||||
if (isFirefox()) { // workaround for firefox bug that ignores top/left for new windows
|
||||
browser.windows.update(wnd.id, { left: dialogData.left, top: dialogData.top });
|
||||
}
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,11 @@ body {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
#login-list {
|
||||
height: 100px;
|
||||
overflow: hidden auto;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark), (prefers-color-scheme: light) {
|
||||
body {
|
||||
background: var(--background-color) !important;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<p align="center" data-i18n="popupAuthText"></p>
|
||||
<div id="login-list" class="list-group"></div>
|
||||
<p align="center">
|
||||
<button id="btn-dismiss" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-remove"></span> <span data-i18n="popupButtonDismissHttpAuth"/></button>
|
||||
<button id="btn-dismiss" class="btn btn-sm btn-danger"><span data-i18n="popupButtonDismissHttpAuth"/></button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue