mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-10-24 12:46:56 +08:00
added new user property metaData
This commit is contained in:
parent
7532ef5b80
commit
105bd36be0
8 changed files with 71 additions and 4 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",
"title": "WildDuck API",
"url": "https://api.wildduck.email",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-11-23T18:50:49.585Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
});
|
||||
define({
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs",
"title": "WildDuck API",
"url": "https://api.wildduck.email",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-11-28T10:19:30.555Z",
"url": "http://apidocjs.com",
"version": "0.17.7"
}
});
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs",
"title": "WildDuck API",
"url": "https://api.wildduck.email",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-11-23T18:50:49.585Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
}
|
||||
{
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs",
"title": "WildDuck API",
"url": "https://api.wildduck.email",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-11-28T10:19:30.555Z",
"url": "http://apidocjs.com",
"version": "0.17.7"
}
}
|
||||
|
|
|
|||
25
docs/locales/cs.js
Normal file
25
docs/locales/cs.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
define({
|
||||
cs: {
|
||||
'Allowed values:' : 'Povolené hodnoty:',
|
||||
'Compare all with predecessor': 'Porovnat vše s předchozími verzemi',
|
||||
'compare changes to:' : 'porovnat změny s:',
|
||||
'compared to' : 'porovnat s',
|
||||
'Default value:' : 'Výchozí hodnota:',
|
||||
'Description' : 'Popis',
|
||||
'Field' : 'Pole',
|
||||
'General' : 'Obecné',
|
||||
'Generated with' : 'Vygenerováno pomocí',
|
||||
'Name' : 'Název',
|
||||
'No response values.' : 'Nebyly vráceny žádné hodnoty.',
|
||||
'optional' : 'volitelné',
|
||||
'Parameter' : 'Parametr',
|
||||
'Permission:' : 'Oprávnění:',
|
||||
'Response' : 'Odpověď',
|
||||
'Send' : 'Odeslat',
|
||||
'Send a Sample Request' : 'Odeslat ukázkový požadavek',
|
||||
'show up to version:' : 'zobrazit po verzi:',
|
||||
'Size range:' : 'Rozsah velikosti:',
|
||||
'Type' : 'Typ',
|
||||
'url' : 'url'
|
||||
}
|
||||
});
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
define([
|
||||
'./locales/ca.js',
|
||||
'./locales/cs.js',
|
||||
'./locales/de.js',
|
||||
'./locales/es.js',
|
||||
'./locales/fr.js',
|
||||
|
|
|
|||
|
|
@ -342,6 +342,7 @@ module.exports = (db, server, userHandler) => {
|
|||
* @apiParam {Boolean} [encryptMessages] If <code>true</code> then received messages are encrypted
|
||||
* @apiParam {Boolean} [encryptForwarded] If <code>true</code> then forwarded messages are encrypted
|
||||
* @apiParam {String} [pubKey] Public PGP key for the User that is used for encryption. Use empty string to remove the key
|
||||
* @apiParam {String} [metaData] Optional metadata, must be JSON formatted
|
||||
* @apiParam {String} [language] Language code for the User
|
||||
* @apiParam {String[]} [targets] An array of forwarding targets. The value could either be an email address or a relay url to next MX server ("smtp://mx2.zone.eu:25") or an URL where mail contents are POSTed to
|
||||
* @apiParam {Number} [spamLevel=50] Relative scale for detecting spam. 0 means that everything is spam, 100 means that nothing is spam
|
||||
|
|
@ -524,6 +525,11 @@ module.exports = (db, server, userHandler) => {
|
|||
.unique()
|
||||
.default([]),
|
||||
|
||||
metaData: Joi.string()
|
||||
.empty('')
|
||||
.trim()
|
||||
.max(1024 * 1024),
|
||||
|
||||
pubKey: Joi.string()
|
||||
.empty('')
|
||||
.trim()
|
||||
|
|
@ -703,6 +709,18 @@ module.exports = (db, server, userHandler) => {
|
|||
return next();
|
||||
}
|
||||
|
||||
if (result.value.metaData) {
|
||||
try {
|
||||
JSON.parse(result.value.metaData);
|
||||
} catch (err) {
|
||||
res.json({
|
||||
error: 'metaData value must be valid JSON',
|
||||
code: 'InputValidationError'
|
||||
});
|
||||
return next();
|
||||
}
|
||||
}
|
||||
|
||||
let id;
|
||||
try {
|
||||
id = await createUser(result.value);
|
||||
|
|
@ -857,6 +875,7 @@ module.exports = (db, server, userHandler) => {
|
|||
* @apiSuccess {String} keyInfo.name Name listed in public key
|
||||
* @apiSuccess {String} keyInfo.address E-mail address listed in public key
|
||||
* @apiSuccess {String} keyInfo.fingerprint Fingerprint of the public key
|
||||
* @apiSuccess {String} metaData Custom metadata set for this user
|
||||
* @apiSuccess {String[]} targets List of forwarding targets
|
||||
* @apiSuccess {Number} spamLevel Relative scale for detecting spam. 0 means that everything is spam, 100 means that nothing is spam
|
||||
* @apiSuccess {Object} limits Account limits and usage
|
||||
|
|
@ -1095,6 +1114,8 @@ module.exports = (db, server, userHandler) => {
|
|||
spamLevel: userData.spamLevel,
|
||||
keyInfo,
|
||||
|
||||
metaData: userData.metaData || '',
|
||||
|
||||
targets: [].concat(userData.targets || []),
|
||||
|
||||
limits: {
|
||||
|
|
@ -1176,6 +1197,7 @@ module.exports = (db, server, userHandler) => {
|
|||
* @apiParam {Boolean} [encryptMessages] If <code>true</code> then received messages are encrypted
|
||||
* @apiParam {Boolean} [encryptForwarded] If <code>true</code> then forwarded messages are encrypted
|
||||
* @apiParam {String} [pubKey] Public PGP key for the User that is used for encryption. Use empty string to remove the key
|
||||
* @apiParam {String} [metaData] Optional metadata, must be JSON formatted
|
||||
* @apiParam {String} [language] Language code for the User
|
||||
* @apiParam {String[]} [targets] An array of forwarding targets. The value could either be an email address or a relay url to next MX server ("smtp://mx2.zone.eu:25") or an URL where mail contents are POSTed to
|
||||
* @apiParam {Number} [spamLevel] Relative scale for detecting spam. 0 means that everything is spam, 100 means that nothing is spam
|
||||
|
|
@ -1269,6 +1291,11 @@ module.exports = (db, server, userHandler) => {
|
|||
.falsy(['N', 'false', 'no', 'off', '0', 0, ''])
|
||||
.default(false),
|
||||
|
||||
metaData: Joi.string()
|
||||
.empty('')
|
||||
.trim()
|
||||
.max(1024 * 1024),
|
||||
|
||||
pubKey: Joi.string()
|
||||
.empty('')
|
||||
.trim()
|
||||
|
|
@ -1438,6 +1465,18 @@ module.exports = (db, server, userHandler) => {
|
|||
return next();
|
||||
}
|
||||
|
||||
if (result.value.metaData) {
|
||||
try {
|
||||
JSON.parse(result.value.metaData);
|
||||
} catch (err) {
|
||||
res.json({
|
||||
error: 'metaData value must be valid JSON',
|
||||
code: 'InputValidationError'
|
||||
});
|
||||
return next();
|
||||
}
|
||||
}
|
||||
|
||||
let success;
|
||||
try {
|
||||
success = await updateUser(user, result.value);
|
||||
|
|
|
|||
|
|
@ -1379,6 +1379,8 @@ class UserHandler {
|
|||
ip: false
|
||||
},
|
||||
|
||||
metaData: data.metaData || '',
|
||||
|
||||
// until setup value is not true, this account is not usable
|
||||
activated: false,
|
||||
disabled: true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue