mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 06:37:10 -04:00
mod so one can set passwords a) for pads that are in no group and b) via the web interface
This commit is contained in:
parent
b0976a292f
commit
dc8ff69553
5 changed files with 66 additions and 29 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue