Signed-off-by: Pierre Noël <petersg83@gmail.com>
This commit is contained in:
Pierre Noël 2020-05-15 17:15:24 +02:00
parent bc3cee4c54
commit 20aedc0e68
10 changed files with 26 additions and 23 deletions

View File

@ -1,7 +1,7 @@
'use strict';
const nodeSES = require('node-ses');
const _ = require('lodash');
const { removeUndefined } = require('strapi-utils');
module.exports = {
init: (providerOptions = {}, settings = {}) => {
@ -24,9 +24,7 @@ module.exports = {
...rest,
};
msg = _.pickBy(msg, value => typeof value !== 'undefined');
client.sendEmail(msg, function(err) {
client.sendEmail(removeUndefined(msg), function(err) {
if (err) {
reject([{ messages: [{ id: 'Auth.form.error.email.invalid' }] }]);
} else {

View File

@ -14,8 +14,8 @@
},
"main": "./lib",
"dependencies": {
"lodash": "^4.17.11",
"node-ses": "^3.0.0"
"node-ses": "^3.0.0",
"strapi-utils": "^3.0.0-beta.20.3"
},
"author": {
"email": "nikolay@tsenkov.net",

View File

@ -1,7 +1,7 @@
'use strict';
const mailgunFactory = require('mailgun-js');
const _ = require('lodash');
const { removeUndefined } = require('strapi-utils');
module.exports = {
init: (providerOptions = {}, settings = {}) => {
@ -27,9 +27,7 @@ module.exports = {
...rest,
};
msg = _.pickBy(msg, value => typeof value !== 'undefined');
mailgun.messages().send(msg, function(err) {
mailgun.messages().send(removeUndefined(msg), function(err) {
if (err) {
reject([{ messages: [{ id: 'Auth.form.error.email.invalid' }] }]);
} else {

View File

@ -13,8 +13,8 @@
},
"main": "./lib",
"dependencies": {
"lodash": "^4.17.11",
"mailgun-js": "0.22.0"
"mailgun-js": "0.22.0",
"strapi-utils": "^3.0.0-beta.20.3"
},
"strapi": {
"isProvider": true

View File

@ -1,7 +1,7 @@
'use strict';
const sendgrid = require('@sendgrid/mail');
const _ = require('lodash');
const { removeUndefined } = require('strapi-utils');
module.exports = {
init: (providerOptions = {}, settings = {}) => {
@ -24,9 +24,7 @@ module.exports = {
...rest,
};
msg = _.pickBy(msg, value => typeof value !== 'undefined');
sendgrid.send(msg, function(err) {
sendgrid.send(removeUndefined(msg), function(err) {
if (err) {
reject([{ messages: [{ id: 'Auth.form.error.email.invalid' }] }]);
} else {

View File

@ -14,7 +14,7 @@
"main": "./lib",
"dependencies": {
"@sendgrid/mail": "6.4.0",
"lodash": "^4.17.11"
"strapi-utils": "^3.0.0-beta.20.3"
},
"strapi": {
"isProvider": true

View File

@ -1,7 +1,7 @@
'use strict';
const sendmailFactory = require('sendmail');
const _ = require('lodash');
const { removeUndefined } = require('strapi-utils');
module.exports = {
init: (providerOptions = {}, settings = {}) => {
@ -26,9 +26,7 @@ module.exports = {
...rest,
};
msg = _.pickBy(msg, value => typeof value !== 'undefined');
sendmail(msg, err => {
sendmail(removeUndefined(msg), err => {
if (err) {
reject([{ messages: [{ id: 'Auth.form.error.email.invalid' }] }]);
} else {

View File

@ -12,8 +12,8 @@
},
"main": "./lib",
"dependencies": {
"lodash": "^4.17.11",
"sendmail": "^1.6.1"
"sendmail": "^1.6.1",
"strapi-utils": "^3.0.0-beta.20.3"
},
"strapi": {
"isProvider": true

View File

@ -21,6 +21,7 @@ const {
getCommonBeginning,
escapeQuery,
} = require('./stringFormatting');
const { removeUndefined } = require('./objectFormatting');
const { getConfigUrls } = require('./config');
module.exports = {
@ -41,4 +42,5 @@ module.exports = {
getCommonBeginning,
getConfigUrls,
escapeQuery,
removeUndefined,
};

View File

@ -0,0 +1,9 @@
'use strict';
const _ = require('lodash');
const removeUndefined = obj => _.pickBy(obj, value => typeof value !== 'undefined');
module.exports = {
removeUndefined,
};