Merge pull request #1065 from keepassxreboot/fix/save_domain_only

Fix Save Domain Only option with Credential Banner
This commit is contained in:
Sami Vänttinen 2020-10-24 19:42:02 +03:00 committed by GitHub
commit 11638218a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -273,7 +273,9 @@ kpxcForm.onSubmit = async function(e) {
}
await kpxc.setPasswordFilled(true);
await sendMessage('page_set_submitted', [ true, usernameValue, passwordValue, trimURL(window.top.location.href), kpxc.credentials ]);
const url = trimURL(kpxc.settings.saveDomainOnlyNewCreds ? window.top.location.origin : window.top.location.href);
await sendMessage('page_set_submitted', [ true, usernameValue, passwordValue, url, kpxc.credentials ]);
// Show the banner if the page does not reload
kpxc.rememberCredentials(usernameValue, passwordValue);
@ -1213,12 +1215,9 @@ kpxc.rememberCredentials = async function(usernameValue, passwordValue, urlValue
}
const getUrl = function() {
let url = kpxc.settings.saveDomainOnlyNewCreds ? document.location.origin : document.location.href;
if (url.indexOf('?') > 0) {
url = url.substring(0, url.indexOf('?'));
if (url.length < document.location.origin.length) {
url = document.location.origin;
}
let url = trimURL(kpxc.settings.saveDomainOnlyNewCreds ? document.location.origin : document.location.href);
if (url.length < document.location.origin.length) {
url = document.location.origin;
}
return url;