diff --git a/server/index.php b/server/index.php index fb857e2..20364c6 100644 --- a/server/index.php +++ b/server/index.php @@ -180,7 +180,7 @@ else } } echo "\n"; - echo ' Master key '; + echo ' Master key '; echo "" . "\n"; if (!isset($_SERVER['HTTPS'])) @@ -197,10 +197,10 @@ if ($user != "") { echo "
Add a new password
\n"; - echo 'URL '; + echo 'URL '; echo 'login '; echo 'password '; - echo 'master key '; + echo 'master key '; echo ''; echo ''; echo ""; @@ -237,8 +237,13 @@ if ($user != "") } ?> -
-
- +
+ Filter onchange='password_filter_changed();'/> + + +
+
+ + diff --git a/server/resources/gpass.css b/server/resources/gpass.css index cb4f3c6..7506b49 100755 --- a/server/resources/gpass.css +++ b/server/resources/gpass.css @@ -124,6 +124,10 @@ input { visibility:hidden; } +#filter { + font-weight:bold; +} + .error { text-align:center; color:red; diff --git a/server/resources/gpass.js b/server/resources/gpass.js index 0f75ca1..6bab5e6 100755 --- a/server/resources/gpass.js +++ b/server/resources/gpass.js @@ -161,6 +161,8 @@ var current_mkey = ""; var clearTimer = null; var global_iv = null; var server_url = window.location.href.split('?')[0]; +var clear_passwords = new Array(); +var block_filter = true; function PasswordEntry (ciphered_login, ciphered_password, salt, shadow_login) { this.ciphered_login = ciphered_login; @@ -426,6 +428,51 @@ async function get_ciphered_credentials(masterkey) req.send("get_secure_passwords=1&user=" + current_user + "&access_tokens=" + access_tokens); } +function password_filter_changed() +{ + if (block_filter) return; + + filter = document.getElementById('password_filter').value ; + if (filter !== '') + filter = '.*' + filter + '.*'; + + password_div = document.getElementById("clear_passwords"); + password_div.removeAllChilds(); + + for (idx in clear_passwords) + { + div = clear_passwords[idx]; + if (typeof(div) === 'function') + continue; + if (filter === '') + password_div.appendChild(div); + else + { + childs = clear_passwords[idx].children; + for (elem_idx in childs) + { + elem = childs[elem_idx]; + if (elem.name == 'url') + { + // Remove * for wildcards domains + target_url = elem.value.replace('*', '') ; + + try { + if (target_url.match(filter)) + password_div.appendChild(div); + } + /* Forgive re errors */ + catch(error) + { + // console.log(error); + } + break; + } + } + } + } +} + async function change_master_key(warning_unciphered) { var nb_unciphered = 0; @@ -439,9 +486,6 @@ async function change_master_key(warning_unciphered) nb_unciphered++; } - if (!nb_unciphered && warning_unciphered) - alert("No password unciphered with this master key !"); - password_div = document.getElementById("passwords"); password_div.removeAllChilds(); @@ -449,6 +493,11 @@ async function change_master_key(warning_unciphered) div.setAttribute("id", "nb_unciphered_passwords"); password_div.appendChild(div); + div = document.createElement("div"); + div.setAttribute("id", "clear_passwords"); + password_div.appendChild(div); + + clear_passwords = new Array(); 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 = ""; update_stats(); + block_filter = false; + password_filter_changed(); } function update_master_key(warning_unciphered) @@ -783,16 +812,14 @@ function add_password() for(i=0; i