First add the main “random” package to generate random code
$ meteor add random
Then intercept the account creation process
Accounts.onCreateUser(function(options, user) {
user.customVerified = false;
user.customVerificationCode = Random.hexString(20).toLowerCase();
myCustomEmailFunction(options.profile.emails[0], user.customVerificationCode);
return user;
});
At this point, if you do not want to display pieces of ui elements to unverified users, you can create a template helper for this. Or you can check if the user is verified in your publications. Etc ... everything you want to limit.
Now you can determine the route in your application using the iron router, so that when the user clicks on the link, the route takes a confirmation code and sets the verified user flag to true.
source
share