From ef0a62d3784d2d92c8143d177ad087b2c3272bfc Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 18 Dec 2014 14:36:05 -0300 Subject: [PATCH 1/2] added resend_email route --- config/routes.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/routes.js b/config/routes.js index f031e38..bf24e00 100644 --- a/config/routes.js +++ b/config/routes.js @@ -68,6 +68,8 @@ module.exports = function(app) { app.post(apiPrefix + '/email/delete/profile', emailPlugin.eraseProfile); app.get(apiPrefix + '/email/delete/item', emailPlugin.erase); + + app.get(apiPrefix + '/email/resend_email', emailPlugin.resendEmail); } // Currency rates plugin From f60ea439bab88f0bcea0b345e7f54f5eecefcede Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 18 Dec 2014 15:48:29 -0300 Subject: [PATCH 2/2] catch error sending email --- plugins/emailstore.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/emailstore.js b/plugins/emailstore.js index 4411cda..70a8e94 100644 --- a/plugins/emailstore.js +++ b/plugins/emailstore.js @@ -755,10 +755,16 @@ var secret = emailPlugin._parseSecret(value); - emailPlugin.sendVerificationEmail(email, secret); - return response.json({ - success: true - }).end(); + emailPlugin.sendVerificationEmail(email, secret, function (err) { + if (err) { + logger.error('error resending verification email', email, secret, err); + return emailPlugin.returnError(emailPlugin.errors.ERROR_SENDING_EMAIL, response); + } + return response.json({ + success: true + }).end(); + + }); }); }); };