Merge remote-tracking branch 'upstream/master'

Conflicts:
	lib/boot.js
This commit is contained in:
Ben Sparks
2011-12-08 18:45:03 -07:00
3 changed files with 9 additions and 11 deletions

View File

@@ -11,19 +11,11 @@ var config = require('./config').load()
, path
;
// expose current directory to plugins
try {
require.paths.unshift('.');
} catch(e) {
// no longer supported
console.warn(e.message);
}
// load plugins
plugins.forEach(function(fd) {
path = __dirname + '/plugins/' + fd;
if(fs.statSync(path).isDirectory()) {
lib[fd] = require(path);
lib[fd] = require(path);
}
});

View File

@@ -44,7 +44,8 @@ module.exports = {
collection(db, model, function(err, collection) {
// TODO limit 1 for models, allow all for collections
collection.find(query).toArray(function(err, results) {
// TODO remove password filter, add to model
collection.find(query, {password: 0}).toArray(function(err, results) {
if(err) throw err;
model.refresh(results);
});

View File

@@ -1,6 +1,7 @@
var Model = require('../../model')
, ObjectID = require('mongodb').BSONPure.ObjectID
, _ = require('underscore')
, crypto = require('crypto')
;
module.exports = Model.spawn({
@@ -51,7 +52,11 @@ module.exports = Model.spawn({
},
hash: function(password) {
return password + 'hash!';
return crypto
.createHash('md5')
.update(password.toString())
.digest('hex')
;
},
defineRoutes: function() {