Working as it should. Except you need to type in your password after you created the pad. But that I won't fix today.

This commit is contained in:
jaseg 2011-12-06 23:12:58 +01:00
parent e9f6a10039
commit c905fd76c1
8 changed files with 182 additions and 17 deletions

View file

@ -71,8 +71,7 @@ function randomString()
var randomstring = '';
for (var i = 0; i < string_length; i++)
{
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars[rnum];
randomstring += chars[Math.floor(Math.random() * chars.length)];
}
return "t." + randomstring;
}
@ -149,7 +148,7 @@ function getUrlVars()
function hash(password, salt)
{
return sha512(password + salt) + "$" + salt;
return $.sha256(password + salt) + "$" + salt;
}
/* Generate the "timed hash" used to get access.
@ -226,13 +225,15 @@ function handshake()
{
$("#editorloadingbox").html("<b>You need a password to access this pad</b><br>" +
"<input id='passwordinput' type='password' name='password'>"+
"<button type='button' onclick='savePassword("+obj.passwordSalt+")'>ok</button>");
"<button type='button' onclick='savePassword(\""+obj.passwordSalt+"\")'>ok</button>");
console.log("passwordSalt: "+obj.passwordSalt);
}
else if(obj.accessStatus == "wrongPassword")
{
$("#editorloadingbox").html("<b>Your password was wrong</b><br>" +
"<input id='passwordinput' type='password' name='password'>"+
"<button type='button' onclick='savePassword("+obj.passwordSalt+")'>ok</button>");
"<button type='button' onclick='savePassword(\""+obj.passwordSalt+"\")'>ok</button>");
console.log("passwordSalt: "+obj.passwordSalt);
}
}