I'm a bit confused about how to use Accounts.onEmailVerificationLink
.
The docs are somewhat ambiguous:
Accounts.onEmailVerificationLink(callback)
Register a function to call when an email verification link is clicked in an email sent by Accounts.sendVerificationEmail. This function should be called in top-level code, not inside Meteor.startup().
What is meant exactly by "this function", the callback, or Accounts.onEmailVerificationLink
itself?
Anyway, no matter where I put things, I always get this error message on the browser console:
Accounts.onEmailVerificationLink was called more than once. Only one callback added will be executed.
If you use collection hooks (https://atmospherejs.com/matb33/collection-hooks), you can do something like this:
Meteor.users.after.update(function (userId, doc, fieldNames, modifier, options) {
if (!!modifier.$set) {
//check if the email was verified
if (modifier.$set['emails.$.verified'] === true) {
//do something
}
}
});
After spending some time trying to hook into the onMailVerificationLink, I find the above to be much less finicky.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With