todos-contra-el-fuego-web/imports/api/Users/server/methods.js
cleverbeagle 379f7dcd76 add support for transactional html/text emails
- Add support for welcome email on user creation (both OAuth and password users)
- Add support for html/text templating on verify email.
- Add support for html/text templating on reset password.
- Add handlers for converting Handlebars templates to HTML and text (template agnostic).
- Add helper function sendEmail() for compiling and sending templates via Email.send() (SMTP).
2017-09-07 17:23:08 -05:00

37 lines
902 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { Accounts } from 'meteor/accounts-base';
import editProfile from './edit-profile';
import rateLimit from '../../../modules/rate-limit';
Meteor.methods({
'users.sendVerificationEmail': function usersSendVerificationEmail() {
return Accounts.sendVerificationEmail(this.userId);
},
'users.editProfile': function usersEditProfile(profile) {
check(profile, {
emailAddress: String,
profile: {
name: {
first: String,
last: String,
},
},
});
return editProfile({ userId: this.userId, profile })
.then(response => response)
.catch((exception) => {
throw new Meteor.Error('500', exception);
});
},
});
rateLimit({
methods: [
'users.sendVerificationEmail',
'users.editProfile',
],
limit: 5,
timeRange: 1000,
});