diff --git a/firefox_addon/lib/main.js b/firefox_addon/lib/main.js index d2bb328..a99e8a2 100644 --- a/firefox_addon/lib/main.js +++ b/firefox_addon/lib/main.js @@ -66,7 +66,7 @@ function generate_request(domain, login, mkey) return enc; } -function ask_server(field, logins, domain, wdomain, mkey, salt) +function ask_server(form, field, logins, domain, wdomain, mkey, salt) { mkey = pkdbf2.pkdbf2(mkey, salt, pkdbf2_level, 256/8); @@ -203,6 +203,9 @@ function ask_server(field, logins, domain, wdomain, mkey, salt) clear_password = clear_password.substr(0, clear_password.length-3); debug("Clear password " + clear_password); field.value = clear_password; + // Remove gPass event listener and submit again with clear password + form.removeEventListener("submit", on_sumbit, true); + form.submit(); } else { @@ -228,7 +231,7 @@ function ask_server(field, logins, domain, wdomain, mkey, salt) }, false); debug("connect to " + prefSet.prefs.account_url); - gPassRequest.open("POST", prefSet.prefs.account_url, false); + gPassRequest.open("POST", prefSet.prefs.account_url, true); gPassRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); gPassRequest.send(keys); @@ -251,6 +254,9 @@ function wildcard_domain(domain) else return "*" + "." + parts[parts.length-2] + "." + parts[parts.length-1]; } + // Simple xxx.com + else if (parts.length == 2) + return "*" + "." + parts[0] + "." + parts[1]; return ""; } @@ -310,18 +316,19 @@ function on_sumbit(e) mkey = password.substring(2); - var ret = ask_server(field, logins, domain, wdomain, mkey, salt); + var ret = ask_server(form, field, logins, domain, wdomain, mkey, salt); switch(ret) { case SERVER.OK: - return true; + e.preventDefault(); + break; case SERVER.FAILED: if (logins !== all_logins) { - ret = ask_server(field, all_logins, domain, wdomain, mkey, salt); + ret = ask_server(form, field, all_logins, domain, wdomain, mkey, salt); if (ret == SERVER.OK) - return true; + break; } e.preventDefault(); break; @@ -332,7 +339,7 @@ function on_sumbit(e) } } - return true; + return false; } function document_loaded(event) diff --git a/firefox_addon/package.json b/firefox_addon/package.json index e4bfaeb..d19189d 100644 --- a/firefox_addon/package.json +++ b/firefox_addon/package.json @@ -5,7 +5,7 @@ "description": "gPass : global password manager", "author": "Grégory Soutadé", "license": "GNU GPL v3", - "version": "0.3", + "version": "0.4", "preferences": [ { "name": "account_url",