verifyEmail.js 796 Bytes
import _                                  from 'lodash';
import { Accounts }                       from 'meteor/accounts-base';
import { Orgs }                           from '/imports/collections/orgs/index';

Accounts.config({
  sendVerificationEmail: true
});

Accounts.emailTemplates.verifyEmail = {
  subject() {
    return '[YoungDesk] Verify Your Email Address';
  },
  text(user, url) {
    const theUrl = Meteor.absoluteUrl(`back/verifyEmail/${_.last(url.split('/'))}`);
    org = Orgs.findOne({"_id":user.orgId});

    OrgUrl = encodeURI(theUrl.replace("http://","http://"+org.slug+"."));
    return (
`
Hello, ${user.firstName}!


To verify your email address, visit the following link:

${OrgUrl}

If you did not request this verification, please ignore this email.

`
    );
  },
};