diff --git a/server/index.php b/server/index.php index 040b77b..2cd359f 100644 --- a/server/index.php +++ b/server/index.php @@ -158,10 +158,10 @@ if ($user != "") { echo "Add a new password
\n"; - echo 'URL '; - echo 'login '; + echo 'URL '; + echo 'login '; echo 'password '; - echo 'master key '; + echo 'master key '; echo ''; echo ''; echo ""; diff --git a/server/resources/gpass.js b/server/resources/gpass.js index db2f42f..e7dd439 100755 --- a/server/resources/gpass.js +++ b/server/resources/gpass.js @@ -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 + 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 = "";