mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-24 19:48:23 +02:00
* More WIP on door support. Proof of concept mostly functional-ish for at least Pimpwars :)
This commit is contained in:
parent
d16beca341
commit
144aa6b351
11 changed files with 352 additions and 93 deletions
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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue