Merge branch 'master' of soutade.fr:gpass

This commit is contained in:
Gregory Soutade 2014-06-10 20:41:06 +02:00
commit f8472d7ca4
3 changed files with 14 additions and 9 deletions

View File

@ -23,6 +23,8 @@ The first thing to do is to populate your database (from your/a password server)
When you're in a login form and you want to use gPass, type your login and fill "@@masterkey" in password field. Then submit and password will automatically be replaced by the one in the database (after addon decrypt it). When you're in a login form and you want to use gPass, type your login and fill "@@masterkey" in password field. Then submit and password will automatically be replaced by the one in the database (after addon decrypt it).
You can also type "@_masterkey" to only replace your password without submiting and manually submit. This allows to support more websites.
Technical details Technical details
----------------- -----------------

View File

@ -66,7 +66,7 @@ function generate_request(domain, login, mkey)
return enc; return enc;
} }
function ask_server(form, field, logins, domain, wdomain, mkey, salt) function ask_server(form, field, logins, domain, wdomain, mkey, salt, submit)
{ {
mkey = pkdbf2.pkdbf2(mkey, salt, pkdbf2_level, 256/8); mkey = pkdbf2.pkdbf2(mkey, salt, pkdbf2_level, 256/8);
@ -204,9 +204,12 @@ function ask_server(form, field, logins, domain, wdomain, mkey, salt)
debug("Clear password " + clear_password); debug("Clear password " + clear_password);
field.value = clear_password; field.value = clear_password;
// Remove gPass event listener and submit again with clear password // Remove gPass event listener and submit again with clear password
if (submit)
{
form.removeEventListener("submit", on_sumbit, true); form.removeEventListener("submit", on_sumbit, true);
form.submit(); form.submit();
} }
}
else else
{ {
debug("No password found"); debug("No password found");
@ -311,26 +314,26 @@ function on_sumbit(e)
{ {
debug(field.value); debug(field.value);
password = field.value; password = field.value;
if (password.indexOf("@@") != 0) if (password.indexOf("@@") != 0 && password.indexOf("@_") != 0)
continue; continue;
mkey = password.substring(2); mkey = password.substring(2);
var ret = ask_server(form, field, logins, domain, wdomain, mkey, salt); e.preventDefault();
var ret = ask_server(form, field, logins, domain, wdomain, mkey, salt, (password.indexOf("@@") == 0));
switch(ret) switch(ret)
{ {
case SERVER.OK: case SERVER.OK:
e.preventDefault();
break; break;
case SERVER.FAILED: case SERVER.FAILED:
if (logins !== all_logins) if (logins !== all_logins)
{ {
ret = ask_server(form, field, all_logins, domain, wdomain, mkey, salt); ret = ask_server(form, field, all_logins, domain, wdomain, mkey, salt, (password.indexOf("@@") == 0));
if (ret == SERVER.OK) if (ret == SERVER.OK)
break; break;
} }
e.preventDefault();
break; break;
case SERVER.RESTART_REQUEST: case SERVER.RESTART_REQUEST:
i = -1; // Restart loop i = -1; // Restart loop

View File

@ -5,7 +5,7 @@
"description": "gPass : global password manager", "description": "gPass : global password manager",
"author": "Grégory Soutadé", "author": "Grégory Soutadé",
"license": "GNU GPL v3", "license": "GNU GPL v3",
"version": "0.4", "version": "0.5",
"preferences": [ "preferences": [
{ {
"name": "account_url", "name": "account_url",