Add "@_" prefix support to replace password without submit

This commit is contained in:
Grégory Soutadé 2014-06-10 19:04:56 +02:00
parent ee75e0ea06
commit b0ea92b71b
2 changed files with 12 additions and 9 deletions

View File

@ -66,7 +66,7 @@ function generate_request(domain, login, mkey)
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);
@ -204,8 +204,11 @@ function ask_server(form, field, logins, domain, wdomain, mkey, salt)
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();
if (submit)
{
form.removeEventListener("submit", on_sumbit, true);
form.submit();
}
}
else
{
@ -311,26 +314,26 @@ function on_sumbit(e)
{
debug(field.value);
password = field.value;
if (password.indexOf("@@") != 0)
if (password.indexOf("@@") != 0 && password.indexOf("@_") != 0)
continue;
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)
{
case SERVER.OK:
e.preventDefault();
break;
case SERVER.FAILED:
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)
break;
}
e.preventDefault();
break;
case SERVER.RESTART_REQUEST:
i = -1; // Restart loop

View File

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