aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--webcastor.js18
1 files 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 = {
71 }, 71 },
72 72
73 open : function(name, password) { 73 open : function(name, password) {
74 var hashedPassword = imports.passwordHash.generate(password); 74 var hashedPassword
75 if (password === '') {
76 hashedPassword = 'none';
77 } else {
78 hashedPassword = imports.passwordHash.generate(password);
79 }
75 Server.db.set(name, hashedPassword); 80 Server.db.set(name, hashedPassword);
76 }, 81 },
77 82
@@ -123,7 +128,6 @@ var Server = {
123 }, 128 },
124 129
125 connectToDb : function() { 130 connectToDb : function() {
126 console.log(params.database.server);
127 var redisURL = imports.url.parse(params.database.server); 131 var redisURL = imports.url.parse(params.database.server);
128 console.log(redisURL); 132 console.log(redisURL);
129 var db = imports.redis.createClient(redisURL.port, redisURL.hostname, { 133 var db = imports.redis.createClient(redisURL.port, redisURL.hostname, {
@@ -148,9 +152,6 @@ var Server = {
148 152
149 app.post('/', function(req, res) { 153 app.post('/', function(req, res) {
150 var password = req.body.password; 154 var password = req.body.password;
151 if (password === null) {
152 password = '';
153 }
154 155
155 var channelName = Channel.create(password); 156 var channelName = Channel.create(password);
156 157
@@ -176,15 +177,14 @@ var Server = {
176 Channel.getPassword(channel, function(hashedPassword) { 177 Channel.getPassword(channel, function(hashedPassword) {
177 178
178 if (hashedPassword === null) { 179 if (hashedPassword === null) {
179 console.log('Client joined and unknown channel'); 180 console.log('Client joined an unknown channel');
180 return; 181 return;
181 } 182 }
182 183
183 console.log(hashedPassword);
184
185 socket.join(channel); 184 socket.join(channel);
186 185
187 if (!imports.passwordHash.verify(password, hashedPassword)) { 186 if (!imports.passwordHash.verify(password, hashedPassword)
187 && hashedPassword !== 'none') {
188 console.log('Client joined ' + channel); 188 console.log('Client joined ' + channel);
189 return; 189 return;
190 } 190 }