Accounts.onEnrollmentLink help


I am trying to understand the lifecycle of account creation and the e-mails that can be sent. The first logical step was to define a callback for new accounts (short pseudo code)

Accounts.onCreateUser(function(options, user) {
 return user;

which sends an e-mail to the user’s first unverified e-mail address with a link back to the site containing something like


When the user clicks on the link in the e-mail, it would call Accounts.onEmailVerificationLink on the client.

And this is where I begin to get lost. According to the documentation it takes callback with two arguments, the token and a done function. What type of logic is supposed to be in this callback, and further more in the done function? Am I supposed to call Accounts.verifyEmail(token, [callback]) at this point? Or in the done function?

I would appreciate if someone could post a working example.

Last but not least there is the welcome e-mail sent with Accounts.sendEnrollmentEmail which contains a link


and the according callback Accounts.onEnrollmentLink. When is this appropriate? When in the lifecycle should the enrollment email be sent (before or after e-mail verification) and what does the enroll-account token accomplish?


Hmm, either this is too trivial and I am stupid for not being able to figure this out, or nobody knows the answer?


Do something like this, create a route first.

Router.route('Accounts.enrollment', {
  path: '/enroll-account/:token',
  template: 'Enrollment',
  onBeforeAction: function () {
    Session.set('_resetPasswordToken', this.params.token);;
  waitOn: function () {
    return Meteor.subscribe('Users.enrolledUser', this.params.token);
  data: function () {
    return Meteor.users.findOne({
      "services.password.reset.token": this.params.token

Then let’s say you have an autoform for your password reset (omit because that’s easy).

  'click button[type="submit"]': function (e, template) {
    if (AutoForm.validateForm('yourformid')) {
      var password = AutoForm.getFieldValue('yourformid', 'password');
      Accounts.resetPassword(Session.get('_resetPasswordToken'), password, function (err) {
        Router.go("somewhere else");


Thanks for replying. The password reset doesn’t seem to be the problem, it basically works out of the box. I was interested in the sign-up vs. e-mail verification cycle.


Hi corvid, for some reason my route never loads. I just see the loading spinner.

I don’t see an error on the client or server re: the subscribe. Any suggestions?


EDIT: You might find this link useful…