* More WIP on door support. Proof of concept mostly functional-ish for at least Pimpwars :)
This commit is contained in:
25
core/user.js
25
core/user.js
@@ -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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user