gPass

gPass Commit Details

Date:2017-07-19 19:17:29 (1 year 1 month ago)
Author:Grégory Soutadé
Commit:6d3a59c36fb1f308941ba495a006f99861df4804
Parents: cd7d299d20ef318742225316ceeeafa691cba9d1
Message:Server: update random password generation and add a "simple password" button

Changes:
Mserver/index.php (1 diff)
Mserver/resources/gpass.js (2 diffs)

File differences

server/index.php
163163
164164
165165
166
166167
167168
168169
echo 'password <input id="new_password" type="text" name="password"/>';
echo 'master key <input type="text" name="mkey" onkeypress="if (event.keyCode == 13) add_password();" onkeyup="chkPass(this.value);"/>';
echo '<input type="button" value="Generate password" onClick="generate_password();"/>';
echo '<input type="button" value="Generate simple password" onClick="generate_simple_password();"/>';
echo "<input type=\"button\" name=\"add\" value=\"Add\" onclick=\"add_password();\"/>";
echo "<br />";
echo '<div><a href="http://en.wikipedia.org/wiki/Password_strength">Master key strength</a><div id="scorebarBorder"><div id="score">0%</div><div id="scorebar">&nbsp;</div></div></div>';
server/resources/gpass.js
5050
5151
5252
53
53
5454
55
56
57
58
59
60
61
62
63
64
65
6655
6756
6857
6958
7059
71
60
7261
73
62
7463
7564
7665
......
8978
9079
9180
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
9296
9397
9498
9599
96100
97101
102
103
104
105
106
107
108
109
110
111
98112
99113
100114
this.removeChild(this.childNodes[0]);
};
function generate_random(size, only_ascii)
function _generate_random(size, symbols)
{
// symbols 32 - 47 / 58 - 64 / 91 - 96 / 123 - 126
// numbers 48 - 57
// upper 65 - 90
// lower 97 - 122
// Give priority to letters (65 - 122 duplicated in front and end of array)
var symbols;
if (only_ascii)
symbols = new Array(65, 90, 97, 122, 40, 47, 48, 57, 65, 90, 97, 122, 123, 126, 65, 90, 97, 122);
else
symbols = new Array(1, 255);
forbidden = new Array('\\');
var res = "";
while (res.length < size)
{
a = Math.round(Math.random() * (symbols.length/2) * 2);
a = Math.floor(Math.random() * (symbols.length/2)) * 2;
diff = symbols[a+1] - symbols[a];
r = Math.round(Math.random()*diff);
r = Math.floor(Math.random()*diff);
if (isNaN(r+symbols[a]))
continue;
character = String.fromCharCode(r + symbols[a]);
return res;
}
function generate_random(size, only_ascii)
{
// symbols 32 - 47 / 58 - 64 / 91 - 96 / 123 - 126
// numbers 48 - 57
// upper 65 - 90
// lower 97 - 122
// Give priority to letters (65 - 122 duplicated)
var symbols;
if (only_ascii)
symbols = new Array(32, 47, 48, 57, 58, 64, 91, 96, 123, 126, 65, 90, 97, 122, 65, 90, 97, 122, 48, 57);
else
symbols = new Array(1, 255);
return _generate_random(size, symbols);
}
function generate_password()
{
document.getElementById("new_password").value = generate_random(16, true);
}
function generate_simple_password()
{
// ! ( ) * + - . _
// numbers 48 - 57
// upper 65 - 90
// lower 97 - 122
symbols = new Array(33, 33, 40, 43, 45, 46, 95, 95, 48, 57, 65, 90, 97, 122, 48, 57, 65, 90, 97, 122, 48, 57, 48, 57, 65, 90, 97, 122);
document.getElementById("new_password").value = _generate_random(8, symbols);
}
function url_domain(data) {
var uri = parseUri(data)
return uri['host'];

Archive Download the corresponding diff file