Server: If we have a current URL in add form and we have a password entry that match this URL, go to the last when all is deciphered

This commit is contained in:
Gregory Soutade
2020-08-16 16:24:38 +02:00
committed by Grégory Soutadé
parent d2fe770463
commit 4cfd61d077
2 changed files with 35 additions and 3 deletions

View File

@@ -490,6 +490,7 @@ async function change_master_key(warning_unciphered)
url = document.createElement("input");
url.setAttribute("type", "text");
url.setAttribute("name", "url");
url.setAttribute("id", "unciph_url_" + i);
url.setAttribute("value", passwords[i].clear_url);
div.appendChild(url);
@@ -577,6 +578,37 @@ async function change_master_key(warning_unciphered)
}
}
cur_url = document.getElementById("new_url").value;
/* If we have a current URL in add form and we have a password entry that match this URL, go to the last */
/* Can't do this before, because everything is not displayed from browser */
if (cur_url !== "")
{
cur_url = url_domain(cur_url);
for(i=0; i<passwords.length; i++)
{
if (!passwords[i].isUnciphered(current_mkey))
continue;
url_elem = document.getElementById("unciph_url_" + i);
target_url = url_elem.value;
// Replace wildcard domain by .*<domain>
if (target_url[0] == "*")
target_url = "." + target_url;
try {
if (cur_url.match(target_url))
{
window.scrollTo(0, url_elem.offsetTop);
break;
}
}
/* Forgive re errors */
catch(error)
{
//console.log(error);
}
}
}
input = document.getElementById("master_key");
input.value = "";