* More WIP on door support. Proof of concept mostly functional-ish for at least Pimpwars :)

This commit is contained in:
Bryan Ashby 2015-08-02 18:27:05 -06:00
parent d16beca341
commit 144aa6b351
11 changed files with 352 additions and 93 deletions

View file

@ -13,6 +13,8 @@ var moment = require('moment');
exports.User = User;
exports.getUserIdAndName = getUserIdAndName;
exports.getUserName = getUserName;
exports.loadProperties = loadProperties;
function User() {
var self = this;
@ -67,6 +69,10 @@ User.AccountStatus = {
active : 1,
};
User.prototype.load = function(userId, cb) {
};
User.prototype.authenticate = function(username, password, cb) {
var self = this;
@ -361,6 +367,25 @@ function getUserIdAndName(username, cb) {
);
}
function getUserName(userId, cb) {
userDb.get(
'SELECT user_name ' +
'FROM user ' +
'WHERE id=?;', [ userId ],
function got(err, row) {
if(err) {
cb(err);
} else {
if(row) {
cb(null, row.user_name);
} else {
cb(new Error('No matching user ID'));
}
}
}
);
}
///////////////////////////////////////////////////////////////////////////////
// Internal utility methods
///////////////////////////////////////////////////////////////////////////////