mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-23 19:20:41 +02:00
System allows non-unique email addresses #7
This commit is contained in:
parent
d7c35911e8
commit
a1f1578048
2 changed files with 98 additions and 3 deletions
21
core/user.js
21
core/user.js
|
@ -15,6 +15,7 @@ exports.User = User;
|
|||
exports.getUserIdAndName = getUserIdAndName;
|
||||
exports.getUserName = getUserName;
|
||||
exports.loadProperties = loadProperties;
|
||||
exports.getUserIdsWithProperty = getUserIdsWithProperty;
|
||||
exports.getUserList = getUserList;
|
||||
|
||||
function User() {
|
||||
|
@ -494,6 +495,26 @@ function loadProperties(options, cb) {
|
|||
});
|
||||
}
|
||||
|
||||
// :TODO: make this much more flexible - propValue should allow for case-insensitive compare, etc.
|
||||
function getUserIdsWithProperty(propName, propValue, cb) {
|
||||
var userIds = [];
|
||||
|
||||
userDb.each(
|
||||
'SELECT user_id ' +
|
||||
'FROM user_property ' +
|
||||
'WHERE prop_name = ? AND prop_value = ?;',
|
||||
[ propName, propValue ],
|
||||
function rowEntry(err, row) {
|
||||
if(!err) {
|
||||
userIds.push(row.user_id);
|
||||
}
|
||||
},
|
||||
function complete() {
|
||||
cb(null, userIds);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getUserList(options, cb) {
|
||||
var userList = [];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue