From 36bc62235bd32b1c07c2f26f060a5f3f059836b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Jyrkk=C3=A4?= Date: Tue, 27 Oct 2015 11:56:16 +0200 Subject: [PATCH 1/2] Use Meteor accounts email verification instead of manual sendmail function. --- lib/_config/_config.js | 1 + lib/_config/accounts.js | 2 +- lib/_config/emails.js | 4 ++++ server/accounts.js | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/_config/_config.js b/lib/_config/_config.js index a8a90ec6ee..738fae1b6b 100644 --- a/lib/_config/_config.js +++ b/lib/_config/_config.js @@ -1,5 +1,6 @@ Config = { name: 'Apinf', + domain: "apinf.io", // How to get this from settings? logoImage: '', title: function() { return TAPi18n.__('configTitle'); diff --git a/lib/_config/accounts.js b/lib/_config/accounts.js index 073292a306..022928a411 100644 --- a/lib/_config/accounts.js +++ b/lib/_config/accounts.js @@ -3,7 +3,7 @@ AccountsTemplates.configure({ enablePasswordChange: true, forbidClientAccountCreation: false, overrideLoginErrors: true, - sendVerificationEmail: false, + sendVerificationEmail: true, lowercaseUsername: false, showAddRemoveServices: true, showForgotPasswordLink: true, diff --git a/lib/_config/emails.js b/lib/_config/emails.js index b6e8190b38..4203745364 100644 --- a/lib/_config/emails.js +++ b/lib/_config/emails.js @@ -4,6 +4,10 @@ if (Meteor.isServer) { options = { siteName: Config.name }; + // Configurations for activation email template + Accounts.emailTemplates.siteName = Config.name; + Accounts.emailTemplates.from = Config.name+" "; + if (Config.socialMedia) { _.each(Config.socialMedia, function(v, k) { return options[k] = v.url; diff --git a/server/accounts.js b/server/accounts.js index ef71084159..857f9ec208 100644 --- a/server/accounts.js +++ b/server/accounts.js @@ -36,7 +36,8 @@ Accounts.onCreateUser(function(options, user) { user.apiUmbrellaUserId = response.data.user.id; user.profile.apiKey = response.data.user.api_key; ApiUmbrellaUsers.insert(response.data.user); - Meteor.call("sendmail", user.emails[0].address); + // Using Meteor Accounts email verification, so we don't need to say this below. + //Meteor.call("sendmail", user.emails[0].address); return user; }); From b8a977e09d60262edc837f43b66af50b8996244a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Jyrkk=C3=A4?= Date: Thu, 29 Oct 2015 13:15:52 +0200 Subject: [PATCH 2/2] Removed sendmail.js server method. Removed commented lines from accounts.js. --- server/accounts.js | 2 -- server/methods/sendmail.js | 15 --------------- 2 files changed, 17 deletions(-) delete mode 100644 server/methods/sendmail.js diff --git a/server/accounts.js b/server/accounts.js index 857f9ec208..c9496adb57 100644 --- a/server/accounts.js +++ b/server/accounts.js @@ -36,8 +36,6 @@ Accounts.onCreateUser(function(options, user) { user.apiUmbrellaUserId = response.data.user.id; user.profile.apiKey = response.data.user.api_key; ApiUmbrellaUsers.insert(response.data.user); - // Using Meteor Accounts email verification, so we don't need to say this below. - //Meteor.call("sendmail", user.emails[0].address); return user; }); diff --git a/server/methods/sendmail.js b/server/methods/sendmail.js deleted file mode 100644 index a29c0ed961..0000000000 --- a/server/methods/sendmail.js +++ /dev/null @@ -1,15 +0,0 @@ -Meteor.methods({ - - "sendmail": function(to) { - var to = to, - from = "register@apinf.io"; - - Email.send({ - from: from, - to: to, - subject: "Registration complete ", - text: "Welcome to Apinf. Enjoy your stay in the world of APIs." - }); - } - -});