From db8ce7203d1d5d8e6b0e29bdfbf7ed399d911048 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Thu, 15 May 2014 16:32:47 +0200 Subject: Accept channels with no password --- webcastor.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/webcastor.js b/webcastor.js index 67b96d3..b652854 100644 --- a/webcastor.js +++ b/webcastor.js @@ -71,7 +71,12 @@ var Channel = { }, open : function(name, password) { - var hashedPassword = imports.passwordHash.generate(password); + var hashedPassword + if (password === '') { + hashedPassword = 'none'; + } else { + hashedPassword = imports.passwordHash.generate(password); + } Server.db.set(name, hashedPassword); }, @@ -123,7 +128,6 @@ var Server = { }, connectToDb : function() { - console.log(params.database.server); var redisURL = imports.url.parse(params.database.server); console.log(redisURL); var db = imports.redis.createClient(redisURL.port, redisURL.hostname, { @@ -148,9 +152,6 @@ var Server = { app.post('/', function(req, res) { var password = req.body.password; - if (password === null) { - password = ''; - } var channelName = Channel.create(password); @@ -176,15 +177,14 @@ var Server = { Channel.getPassword(channel, function(hashedPassword) { if (hashedPassword === null) { - console.log('Client joined and unknown channel'); + console.log('Client joined an unknown channel'); return; } - console.log(hashedPassword); - socket.join(channel); - if (!imports.passwordHash.verify(password, hashedPassword)) { + if (!imports.passwordHash.verify(password, hashedPassword) + && hashedPassword !== 'none') { console.log('Client joined ' + channel); return; } -- cgit v1.2.3