From 4271551fed0ee18a7a81b8748758cce7c1eb0bc1 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 16 Aug 2020 15:29:56 +0200 Subject: [PATCH 1/2] Add clear form button for "Add new password" div --- server/index.php | 1 + server/resources/gpass.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/server/index.php b/server/index.php index 4e215cf..040b77b 100644 --- a/server/index.php +++ b/server/index.php @@ -167,6 +167,7 @@ if ($user != "") echo ""; echo "
"; echo '
Master key strength
0%
 
'; + echo ""; } ?> diff --git a/server/resources/gpass.js b/server/resources/gpass.js index 6106ef7..db2f42f 100755 --- a/server/resources/gpass.js +++ b/server/resources/gpass.js @@ -109,6 +109,21 @@ function generate_simple_password() document.getElementById("new_password").value = _generate_random(8, symbols); } +function clear_form() +{ + div = document.getElementById("add_new_password"); + + inputs = div.getElementsByTagName("input"); + + for(i=0; i Date: Sun, 16 Aug 2020 16:24:38 +0200 Subject: [PATCH 2/2] 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 --- server/index.php | 6 +++--- server/resources/gpass.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) 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 = "";