Finish refactoring api
This commit is contained in:
parent
a20df07515
commit
f523649f54
17
api.js
17
api.js
|
@ -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
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue