Finish refactoring api

This commit is contained in:
calzoneman 2013-08-16 10:37:26 -05:00
parent a20df07515
commit f523649f54
2 changed files with 18 additions and 5 deletions

17
api.js
View file

@ -499,10 +499,19 @@ module.exports = function (Server) {
return;
}
var channels = Server.db.listUserChannels(name);
res.jsonp({
success: true,
channels: channels
db.listUserChannels(name, function (err, res) {
if(err) {
res.jsonp({
success: false,
channels: []
});
return;
}
res.jsonp({
success: true,
channels: res
});
});
});

View file

@ -1,6 +1,10 @@
module.exports = {
isValidChannelName: function (name) {
return name.match(/^[\w-_]+$/);
return name.match(/^[\w-_]{1,30}$/);
},
isValidUserName: function (name) {
return name.match(/^[\w-_]{1,20}$/);
},
randomSalt: function (length) {