summaryrefslogtreecommitdiffstats
path: root/models/users.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-03-28 20:52:39 +0300
committerGitHub <noreply@github.com>2017-03-28 20:52:39 +0300
commit0c36f5f4c27dce6207b1d8093f387d6a55a6da02 (patch)
treead3ebadd5bb7e1da31b151e1d06a6e20309b493c /models/users.js
parentb3cd2f212599f8d0f9b841c5cf1dfaf57a84d8d7 (diff)
parent5db786e2ddca5bc416612778bb0de0d8338003eb (diff)
downloadwekan-0c36f5f4c27dce6207b1d8093f387d6a55a6da02.tar.gz
wekan-0c36f5f4c27dce6207b1d8093f387d6a55a6da02.tar.bz2
wekan-0c36f5f4c27dce6207b1d8093f387d6a55a6da02.zip
Merge pull request #943 from Zokormazo/smtp
Don't send emails if missing smtp host
Diffstat (limited to 'models/users.js')
-rw-r--r--models/users.js36
1 files changed, 18 insertions, 18 deletions
diff --git a/models/users.js b/models/users.js
index cdc4d9dc..f944d7b1 100644
--- a/models/users.js
+++ b/models/users.js
@@ -373,24 +373,25 @@ if (Meteor.isServer) {
board.addMember(user._id);
user.addInvite(boardId);
- try {
- const params = {
- user: user.username,
- inviter: inviter.username,
- board: board.title,
- url: board.absoluteUrl(),
- };
- const lang = user.getLanguage();
- Email.send({
- to: user.emails[0].address.toLowerCase(),
- from: Accounts.emailTemplates.from,
- subject: TAPi18n.__('email-invite-subject', params, lang),
- text: TAPi18n.__('email-invite-text', params, lang),
- });
- } catch (e) {
- throw new Meteor.Error('email-fail', e.message);
+ if (Settings.findOne().mailUrl()) {
+ try {
+ const params = {
+ user: user.username,
+ inviter: inviter.username,
+ board: board.title,
+ url: board.absoluteUrl(),
+ };
+ const lang = user.getLanguage();
+ Email.send({
+ to: user.emails[0].address.toLowerCase(),
+ from: Accounts.emailTemplates.from,
+ subject: TAPi18n.__('email-invite-subject', params, lang),
+ text: TAPi18n.__('email-invite-text', params, lang),
+ });
+ } catch (e) {
+ throw new Meteor.Error('email-fail', e.message);
+ }
}
-
return { username: user.username, email: user.emails[0].address };
},
});
@@ -510,4 +511,3 @@ if (Meteor.isServer) {
}
});
}
-