Permalink
Browse files

Finish v0.8.10

  • Loading branch information...
itayw committed May 9, 2015
2 parents 9b9b447 + 375e007 commit cbe8e027c95ab105ceae1c4b379feaa1f00e5a2f
View
@@ -183,6 +183,8 @@ auth.generateToken = function (req, user, callback) {
/* istanbul ignore else */
if (joola.redis) {
return joola.redis.hmset(joola.config.namespace + ':auth:tokens:' + token._, token, function (err) {
if (err)
return callback(err);
joola.memory.set('token:' + token._, token, (joola.config.get('authentication:tokens:expireafter') || 20 * 60 * 1000 /*20 minutes*/));
token.user = JSON.parse(token.user);
joola.logger.trace({category: 'security'}, '[auth] generated token [' + token._ + '] for [' + token.user.username + '].');
View
@@ -61,6 +61,7 @@ common.uuid = function (length) {
}
return result.join('');
}
return randomString(length || 32, 'abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789');
};
@@ -233,15 +234,15 @@ common.objToArray = function (obj) {
};
common.flatGetSet = function (obj, is, value) {
if (typeof is == 'string'){
if (typeof is == 'string') {
return common.flatGetSet(obj, is.split('.'), value);
}
else if (is.length == 1 && value !== undefined) {
if (value === null) {
//console.log('delete',obj, is[0]);
return delete obj[is[0]];
}
else{
else {
return obj[is[0]] = value; // jshint ignore:line
}
}
@@ -311,4 +312,8 @@ common.hashPassword = function (plainPassword, salt) {
/* istanbul ignore next */
return null;
}
};
common.inspect = function (obj) {
return require('util').inspect(obj, {depth: null, colors: true});
};
View
@@ -32,35 +32,25 @@ etl.verify = function (context, workspace, collection, documents, callback) {
documents = [documents];
var buildRowKey = function (obj) {
var key = '';
var hashCode = function(str){
var hash = 0;
if (str.length === 0) return hash;
for (var i = 0; i < str.length; i++) {
var char = str.charCodeAt(i);
hash = ((hash<<5)-hash)+char;
hash = hash & hash; // Convert to 32bit integer
var key = obj.timestamp.toISOString();
traverse.map(obj, function (x) {
if (x && typeof (x) === 'string') {
key += x;
}
return hash;
};
Object.keys(obj).forEach(function (k) {
var value = obj[k];
var type = typeof value;
if (type === 'string' || k === 'timestamp')
key += value;
});
key = joola.common.hash(key);
return key;
};
async.map(documents, function (doc, callback) {
try {
doc._key = buildRowKey(doc);
if (!doc.timestamp)
doc.timestamp = new Date();
else {
doc.timestamp = new Date(doc.timestamp.value || doc.timestamp);
}
doc._key = buildRowKey(doc);
}
catch (ex) {
return callback(ex);
@@ -332,14 +322,10 @@ exports.insert = {
etl.verify(context, workspace, collection, documents, function (err) {
if (err)
return setImmediate(function () {
return callback(err);
});
return callback(err);
etl.load(context, workspace, collection, documents, {}, function (err, documents) {
if (err)
return setImmediate(function () {
return callback(err);
});
return callback(err);
return setImmediate(function () {
var end_ts = new Date().getTime();
@@ -368,9 +354,7 @@ exports.insert = {
/* istanbul ignore next */
console.log(ex.stack);
return setImmediate(function () {
return callback(ex);
});
return callback(ex);
}
}
};
Oops, something went wrong.

0 comments on commit cbe8e02

Please sign in to comment.