mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-10-03 10:24:33 +08:00
Updated address resolving
This commit is contained in:
parent
55d7b87915
commit
5b89511c35
7 changed files with 23 additions and 18 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
define({
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs. Under construction, see old docs here: https://github.com/nodemailer/wildduck/blob/master/docs/api.md",
"title": "WildDuck API",
"url": "http://localhost:8080",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2017-12-01T13:04:16.194Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
});
|
||||
define({
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs. Under construction, see old docs here: https://github.com/nodemailer/wildduck/blob/master/docs/api.md",
"title": "WildDuck API",
"url": "http://localhost:8080",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2017-12-01T13:21:34.058Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
{
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs. Under construction, see old docs here: https://github.com/nodemailer/wildduck/blob/master/docs/api.md",
"title": "WildDuck API",
"url": "http://localhost:8080",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2017-12-01T13:04:16.194Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
}
|
||||
{
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs. Under construction, see old docs here: https://github.com/nodemailer/wildduck/blob/master/docs/api.md",
"title": "WildDuck API",
"url": "http://localhost:8080",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2017-12-01T13:21:34.058Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
}
|
||||
|
|
|
@ -223,9 +223,12 @@ module.exports = (db, server) => {
|
|||
.lowercase()
|
||||
.length(24)
|
||||
.required(),
|
||||
address: Joi.string()
|
||||
.email()
|
||||
.required(),
|
||||
address: [
|
||||
Joi.string()
|
||||
.email()
|
||||
.required(),
|
||||
Joi.string().regex(/^\w+@\*$/, 'special address')
|
||||
],
|
||||
main: Joi.boolean().truthy(['Y', 'true', 'yes', 1]),
|
||||
allowWildcard: Joi.boolean().truthy(['Y', 'true', 'yes', 1])
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = (db, server) => {
|
|||
/**
|
||||
* @api {get} /addresses List registered Domain Aliases
|
||||
* @apiName GetAliases
|
||||
* @apiGroup Domain Aliases
|
||||
* @apiGroup DomainAliases
|
||||
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
|
||||
* @apiHeaderExample {json} Header-Example:
|
||||
* {
|
||||
|
@ -183,8 +183,8 @@ module.exports = (db, server) => {
|
|||
/**
|
||||
* @api {post} /domainaliases/addresses Create new Domain Alias
|
||||
* @apiName PostDomainAlias
|
||||
* @apiGroup Domain Aliases
|
||||
* @apiDescription Add a new Alias for a Domain
|
||||
* @apiGroup DomainAliases
|
||||
* @apiDescription Add a new Alias for a Domain. This allows to accept mail on username@domain and username@alias
|
||||
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
|
||||
* @apiHeaderExample {json} Header-Example:
|
||||
* {
|
||||
|
@ -225,10 +225,12 @@ module.exports = (db, server) => {
|
|||
|
||||
const schema = Joi.object().keys({
|
||||
alias: Joi.string()
|
||||
.hostname()
|
||||
.max(255)
|
||||
//.hostname()
|
||||
.required(),
|
||||
domain: Joi.string()
|
||||
.hostname()
|
||||
.max(255)
|
||||
//.hostname()
|
||||
.required()
|
||||
});
|
||||
|
||||
|
@ -296,7 +298,7 @@ module.exports = (db, server) => {
|
|||
/**
|
||||
* @api {get} /domainaliases/:alias Request Alias information
|
||||
* @apiName GetDomainAlias
|
||||
* @apiGroup Domain Aliases
|
||||
* @apiGroup DomainAliases
|
||||
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
|
||||
* @apiHeaderExample {json} Header-Example:
|
||||
* {
|
||||
|
@ -392,7 +394,7 @@ module.exports = (db, server) => {
|
|||
/**
|
||||
* @api {delete} /domainaliases/:alias Delete an Alias
|
||||
* @apiName DeleteDomainAlias
|
||||
* @apiGroup Domain Aliases
|
||||
* @apiGroup DomainAliases
|
||||
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
|
||||
* @apiHeaderExample {json} Header-Example:
|
||||
* {
|
||||
|
|
|
@ -87,7 +87,7 @@ class UserHandler {
|
|||
|
||||
// try an alias
|
||||
let checkAliases = done => {
|
||||
this.users.collection('domainalias').findOne({ alias: address.substr(address.indexOf('@') + 1) }, (err, aliasData) => {
|
||||
this.users.collection('domainaliases').findOne({ alias: address.substr(address.indexOf('@') + 1) }, (err, aliasData) => {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
@ -134,12 +134,12 @@ class UserHandler {
|
|||
}
|
||||
|
||||
if (addressData) {
|
||||
next(null, { _id: addressData.user });
|
||||
return next(null, { _id: addressData.user });
|
||||
}
|
||||
// try to find a catch-all user
|
||||
this.users.collection('addresses').findOne(
|
||||
{
|
||||
addrview: address.substr(0, address.indexOf('@')).replace(/\./g, '') + +'@*'
|
||||
addrview: address.substr(0, address.indexOf('@')).replace(/\./g, '') + '@*'
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
|
@ -155,7 +155,7 @@ class UserHandler {
|
|||
return callback(null, false);
|
||||
}
|
||||
|
||||
next(null, { _id: addressData.user });
|
||||
return next(null, { _id: addressData.user });
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue