diff --git a/node/db/API.js b/node/db/API.js index 9912b098d..973d60d28 100644 --- a/node/db/API.js +++ b/node/db/API.js @@ -280,11 +280,11 @@ Example returns: exports.setPublicStatus = function(padID, publicStatus, callback) { //ensure this is a group pad - if(padID.indexOf("$") == -1) + /*if(padID.indexOf("$") == -1) { callback({stop: "You can only get/set the publicStatus of pads that belong to a group"}); return; - } + }*/ //get the pad getPadSafe(padID, true, function(err, pad) @@ -349,8 +349,8 @@ exports.setPassword = function(padID, password, callback) //ensure this is a group pad if(padID.indexOf("$") == -1) { - callback({stop: "You can only get/set the password of pads that belong to a group"}); - return; + //callback({stop: "You can only get/set the password of pads that belong to a group"}); + //return; } //get the pad diff --git a/node/db/GroupManager.js b/node/db/GroupManager.js index 1598e72e1..df0445e1b 100644 --- a/node/db/GroupManager.js +++ b/node/db/GroupManager.js @@ -202,7 +202,7 @@ exports.createGroupPad = function(groupID, padName, text, callback) } }); }, - //ensure pad does not exists + //ensure pad does not exist function (callback) { padManager.doesPadExists(padID, function(err, exists) @@ -278,8 +278,7 @@ function randomString(len) var randomstring = ''; for (var i = 0; i < len; i++) { - var rnum = Math.floor(Math.random() * chars.length); - randomstring += chars.substring(rnum, rnum + 1); + randomstring += chars[Math.floor(Math.random() * chars.length)]; } return randomstring; } diff --git a/node/db/Pad.js b/node/db/Pad.js index bba7562c8..4214b8d99 100644 --- a/node/db/Pad.js +++ b/node/db/Pad.js @@ -52,7 +52,7 @@ Class('Pad', { publicStatus : { is: 'rw', - init: false, + init: true, getterName : 'getPublicStatus' }, //publicStatus @@ -486,7 +486,11 @@ Class('Pad', { }, setPassword: function(password) { - this.passwordHash = password == null ? null : hash(password, generateSalt()); + if(password == null){ + this.passwordHash = null; + }else{ + this.passwordHash = hash(password, generateSalt()); + } db.setSub("pad:"+this.id, ["passwordHash"], this.passwordHash); }, isCorrectPassword: function(password) @@ -516,8 +520,7 @@ function generateSalt() var randomstring = ''; for (var i = 0; i < len; i++) { - var rnum = Math.floor(Math.random() * chars.length); - randomstring += chars.substring(rnum, rnum + 1); + randomstring += chars[Math.floor(Math.random() * chars.length)]; } return randomstring; } diff --git a/node/db/SecurityManager.js b/node/db/SecurityManager.js index 7ad8f8d25..0a20a6f7d 100644 --- a/node/db/SecurityManager.js +++ b/node/db/SecurityManager.js @@ -35,7 +35,7 @@ var sessionManager = require("./SessionManager"); exports.checkAccess = function (padID, sessionID, token, password, callback) { // it's not a group pad, means we can grant access - if(padID.indexOf("$") == -1) + /*if(padID.indexOf("$") == -1) { //get author for this token authorManager.getAuthor4Token(token, function(err, author) @@ -46,7 +46,7 @@ exports.checkAccess = function (padID, sessionID, token, password, callback) //don't continue return; - } + }*/ var groupID = padID.split("$")[0]; var padExists = false; diff --git a/static/index.html b/static/index.html index e995cdb2f..a24a45e92 100644 --- a/static/index.html +++ b/static/index.html @@ -69,7 +69,7 @@ font-weight: bold; font-size: 15px } - input[type="text"] { + input[type="text"], input[type="password"] { width: 243px; padding: 10px 47px 10px 10px; background: #fff; @@ -78,7 +78,13 @@ border-radius: 3px; text-shadow: 0 0 1px #fff } - input[type="submit"] { + #usepwlabel { + display: inline; + } + #usePasswordContainer { + margin: 10px 0 5px 0 + } + input[type="submit"] { width: 45px; margin-left: -50px; padding: 8px @@ -88,39 +94,68 @@ +
New Pad

or create/open a Pad with the name
- - + +
+
+
- \ No newline at end of file +