如何使用 Accounts.onEmailVerificationLink?

wil*_*emx 5 meteor meteor-accounts

我对如何使用Accounts.onEmailVerificationLink.
文档有点模棱两可:

Accounts.onEmailVerificationLink(回调)

注册一个函数,当单击 Accounts.sendVerificationEmail 发送的电子邮件中的电子邮件验证链接时调用。这个函数 应该在顶级代码中调用,而不是在 Meteor.startup() 中。

“这个函数”、回调函数或Accounts.onEmailVerificationLink它本身究竟是什么意思?

无论如何,无论我把东西放在哪里,我总是在浏览器控制台上收到此错误消息:

Accounts.onEmailVerificationLink was called more than once. Only one callback added will be executed.
Run Code Online (Sandbox Code Playgroud)

小智 -2

如果可以的话,你应该删除accounts:ui包,它也在使用它

meteor remove accounts:ui
Run Code Online (Sandbox Code Playgroud)

然后使用回调添加您自己的逻辑

Accounts.onEmailVerificationLink(function(token, done) {
  //your own logic
  //Accounts.verifyEmail(token, (error){
  //  if(!error) {
  //    alert('done!');
  //  }
  //});
});
Run Code Online (Sandbox Code Playgroud)