Now addon automatically sends wildcard domain in addition to current domain to increase website compatibility
This commit is contained in:
parent
71b17a1ff0
commit
8a22db95dc
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2013 Grégory Soutadé
|
||||
Copyright (C) 2013-2014 Grégory Soutadé
|
||||
|
||||
This file is part of gPass.
|
||||
|
||||
|
@ -26,7 +26,7 @@ var pkdbf2 = require("pkdbf2").pkdbf2;
|
|||
var aes = require("jsaes").aes;
|
||||
var parseURI = require("parseuri").parseURI;
|
||||
var prefSet = require("simple-prefs");
|
||||
var DEBUG = false;
|
||||
var DEBUG = true;
|
||||
|
||||
|
||||
// http://stackoverflow.com/questions/3745666/how-to-convert-from-hex-to-ascii-in-javascript
|
||||
|
@ -54,6 +54,26 @@ function debug(s)
|
|||
console.log(s);
|
||||
}
|
||||
|
||||
function wildcard_domain(domain)
|
||||
{
|
||||
parts = domain.split(".");
|
||||
|
||||
if (parts.length >= 3)
|
||||
{
|
||||
// Seems to be a two level root domain (ie zzz.xxx.co.uk ...)
|
||||
if (parts[parts.length-2].lenght <= 3)
|
||||
{
|
||||
if (parts.length > 3)
|
||||
return "*" + "." + parts[parts.length-3] + "." + parts[parts.length-2] + "." + parts[parts.length-1];
|
||||
}
|
||||
// Standard root domain (zzz.xxx.com)
|
||||
else
|
||||
return "*" + "." + parts[parts.length-2] + "." + parts[parts.length-1];
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function on_sumbit(e)
|
||||
{
|
||||
var form = this;
|
||||
|
@ -62,6 +82,7 @@ function on_sumbit(e)
|
|||
|
||||
domain = parseURI.parseUri(form.ownerDocument.baseURI);
|
||||
domain = domain["host"];
|
||||
wdomain = wildcard_domain(domain);
|
||||
|
||||
salt = parseURI.parseUri(prefSet.prefs["account_url"]);
|
||||
salt = salt["host"] + salt["path"];
|
||||
|
@ -116,6 +137,19 @@ function on_sumbit(e)
|
|||
|
||||
keys += (keys.length != 0) ? "&" : "";
|
||||
keys += "k" + a + "=" + a2hex(enc);
|
||||
|
||||
if (wdomain != "")
|
||||
{
|
||||
v = "@@" + wdomain + ";" + logins[a];
|
||||
debug("will encrypt " + v);
|
||||
debug("with " + a2hex(mkey));
|
||||
enc = aes.encryptLongString(v, aes.init(mkey));
|
||||
aes.finish();
|
||||
debug("res " + enc);
|
||||
|
||||
keys += (keys.length != 0) ? "&" : "";
|
||||
keys += "k" + a + "=" + a2hex(enc);
|
||||
}
|
||||
}
|
||||
|
||||
debug(keys);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"description": "gPass : global password manager",
|
||||
"author": "Grégory Soutadé",
|
||||
"license": "GNU GPL v3",
|
||||
"version": "0.1",
|
||||
"version": "0.2",
|
||||
"preferences": [{
|
||||
"name": "account_url",
|
||||
"title": "Account URL",
|
||||
|
|
Loading…
Reference in New Issue
Block a user