mirror of
https://github.com/mclueppers/xo-server.git
synced 2025-07-29 08:54:44 +02:00
Minor fix.
This commit is contained in:
parent
34a77d4a11
commit
937345f0e0
@ -19,6 +19,7 @@
|
|||||||
"js-yaml": ">=2.1.0",
|
"js-yaml": ">=2.1.0",
|
||||||
"q": ">=0.9.6",
|
"q": ">=0.9.6",
|
||||||
"sync": ">=0.2.2",
|
"sync": ">=0.2.2",
|
||||||
|
"then-redis": ">=0.3.8",
|
||||||
"underscore": ">=1.4.4",
|
"underscore": ">=1.4.4",
|
||||||
"validator": ">=1.2.1",
|
"validator": ">=1.2.1",
|
||||||
"ws": ">=0.4.27",
|
"ws": ">=0.4.27",
|
||||||
|
@ -3,7 +3,6 @@ var Q = require('q');
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// @todo Add events.
|
|
||||||
function Collection(models)
|
function Collection(models)
|
||||||
{
|
{
|
||||||
// Parent constructor.
|
// Parent constructor.
|
||||||
|
@ -355,5 +355,8 @@ Q.ninvoke(require('fs'), 'readFile', __dirname +'/../config/local.yaml', {'encod
|
|||||||
console.log('XO-Server Web server is listening on port '+ port +'.');
|
console.log('XO-Server Web server is listening on port '+ port +'.');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var redis = require('then-redis').createClient('tcp://localhost:6379');
|
||||||
|
|
||||||
|
|
||||||
xo.start(cfg);
|
xo.start(cfg);
|
||||||
}).done();
|
}).done();
|
||||||
|
13
src/xo.js
13
src/xo.js
@ -61,7 +61,7 @@ var Token = Model.extend({
|
|||||||
return Q.ninvoke(crypto, 'randomBytes', 32).then(function (buf) {
|
return Q.ninvoke(crypto, 'randomBytes', 32).then(function (buf) {
|
||||||
return new Token({
|
return new Token({
|
||||||
'id': buf.toString('base64'),
|
'id': buf.toString('base64'),
|
||||||
'user_id': user_id,
|
'user_id': +user_id,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -548,7 +548,13 @@ function Xo()
|
|||||||
});
|
});
|
||||||
xo.users.on('remove', function (user_ids) {
|
xo.users.on('remove', function (user_ids) {
|
||||||
_.each(user_ids, function (user_id) {
|
_.each(user_ids, function (user_id) {
|
||||||
|
user_id = +user_id;
|
||||||
xo.emit('user.revoked:'+ user_id);
|
xo.emit('user.revoked:'+ user_id);
|
||||||
|
|
||||||
|
// All associated tokens must be destroyed too.
|
||||||
|
xo.tokens.get({'user_id': user_id}).then(function (tokens) {
|
||||||
|
return xo.tokens.remove(_.pluck(tokens, 'id'));
|
||||||
|
}).done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -573,11 +579,6 @@ function Xo()
|
|||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
// Temporary data for testing purposes.
|
// Temporary data for testing purposes.
|
||||||
|
|
||||||
//xo.servers.add([{
|
|
||||||
// 'host': '192.168.1.116',
|
|
||||||
// 'username': 'root',
|
|
||||||
// 'password': 'qwerty',
|
|
||||||
//}]).done();
|
|
||||||
xo.users.add([{
|
xo.users.add([{
|
||||||
'email': 'bob@gmail.com',
|
'email': 'bob@gmail.com',
|
||||||
'pw_hash': '$2a$10$PsSOXflmnNMEOd0I5ohJQ.cLty0R29koYydD0FBKO9Rb7.jvCelZq',
|
'pw_hash': '$2a$10$PsSOXflmnNMEOd0I5ohJQ.cLty0R29koYydD0FBKO9Rb7.jvCelZq',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user