mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-03-03 19:33:36 +08:00
Updated account creation handlers
This commit is contained in:
parent
3068898bb8
commit
fcfff798e8
1 changed files with 16 additions and 1 deletions
|
@ -20,6 +20,9 @@ module.exports = (db, server, userHandler) => {
|
|||
.alphanum()
|
||||
.lowercase()
|
||||
.max(128),
|
||||
onlyAddresses: Joi.boolean()
|
||||
.truthy(['Y', 'true', 'yes', 1])
|
||||
.default(false),
|
||||
limit: Joi.number()
|
||||
.default(20)
|
||||
.min(1)
|
||||
|
@ -56,13 +59,25 @@ module.exports = (db, server, userHandler) => {
|
|||
|
||||
let filter = query
|
||||
? {
|
||||
unameview: {
|
||||
address: {
|
||||
$regex: query.replace(/\./g, ''),
|
||||
$options: ''
|
||||
}
|
||||
}
|
||||
: {};
|
||||
|
||||
if (result.value.onlyAddresses) {
|
||||
if (filter.address) {
|
||||
filter.$and = [].concat(filter.$and || []).concat(filter.address);
|
||||
delete filter.address;
|
||||
filter.$and.push({
|
||||
address: { $ne: '' }
|
||||
});
|
||||
} else {
|
||||
filter.address = { $ne: '' };
|
||||
}
|
||||
}
|
||||
|
||||
db.users.collection('users').count(filter, (err, total) => {
|
||||
if (err) {
|
||||
res.json({
|
||||
|
|
Loading…
Reference in a new issue