From a994074db066dd32ae7df6bd7dbbf5375181bc08 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Wed, 16 Oct 2013 18:40:06 +0200 Subject: [PATCH] Server side : * Add $ADMIN_MODE to enable create users * Add protocol version (1 for now) * Give priority to letters in password generator Client side : * Don't still use global variable to get document after loading * Add email type in possible values for username (used by gmail) --- firefox_addon/lib/main.js | 65 ++++++++++++++++++++++---------------- server/index.php | 5 +-- server/ref/index.php | 4 +++ server/ressources/gpass.js | 5 ++- 4 files changed, 47 insertions(+), 32 deletions(-) diff --git a/firefox_addon/lib/main.js b/firefox_addon/lib/main.js index d71e45d..9b49a4d 100644 --- a/firefox_addon/lib/main.js +++ b/firefox_addon/lib/main.js @@ -26,8 +26,6 @@ var pkdbf2 = require("pkdbf2").pkdbf2; var aes = require("jsaes").aes; var parseURI = require("parseuri").parseURI; var prefSet = require("simple-prefs"); -// Global document -var doc; var DEBUG = false; @@ -68,13 +66,13 @@ function on_sumbit() salt = parseURI.parseUri(prefSet.prefs["account_url"]); salt = salt["host"] + salt["path"]; - console.log("salt " + salt); + debug("salt " + salt); // Get all for (i=0; ilogo -
+
>
diff --git a/server/ref/index.php b/server/ref/index.php index d0300d3..bf19044 100755 --- a/server/ref/index.php +++ b/server/ref/index.php @@ -31,12 +31,16 @@ function load_database() return $db; } +$PROTOCOL_VERSION = 1; + $db = load_database(); $res = ""; $statement = $db->prepare("SELECT password FROM gpass WHERE login=:login"); +echo "protocol=$PROTOCOL_VERSION\n"; + for ($i=0; isset($_POST["k$i"]); $i++) { $statement->bindValue(":login", $_POST["k$i"]); diff --git a/server/ressources/gpass.js b/server/ressources/gpass.js index 4dc90ea..61bf4ff 100755 --- a/server/ressources/gpass.js +++ b/server/ressources/gpass.js @@ -37,13 +37,12 @@ function generate_password() // numbers 48 - 57 // upper 65 - 90 // lower 97 - 122 - var symbols = new Array(40, 47, 48, 57, 65, 90, 97, 122, 123, 126); - // var symbols = new Array(32, 47, 58, 64, 91, 96, 123, 126, 48, 57, 65, 90, 97, 122); + // Give priority to letters (65 - 122 duplicated in front and end of array) + var symbols = new Array(65, 90, 97, 122, 40, 47, 48, 57, 65, 90, 97, 122, 123, 126, 65, 90, 97, 122); field = document.getElementById("new_password"); var res = ""; - //for(i=0; i<16; i++) while (res.length < 16) { a = Math.round(Math.random() * (symbols.length/2) * 2);