【发布时间】:2016-02-16 00:25:43
【问题描述】:
我希望能够向 Meteor 应用程序的用户重新发送电子邮件验证链接,以防他们意外删除了电子邮件验证电子邮件。
我有一个 ID 为“resentEmailVerificationLink”的链接
我的客户端中有以下代码,用于单击链接时(警报只是用来向我自己显示该函数在出现错误之前的距离):
Template.dashboard.events({
'click #resentEmailVerificationLink' : function(event) {
event.preventDefault();
var id = Meteor.userId();
alert('clicked: ' + id);
Accounts.sendVerificationEmail(id);
alert('Verification Email resent');
return false; // Stops page from reloading
}
)};
我知道 sendVerificationEmail 是一个服务器函数,但我不知道如何在单击验证电子邮件链接后在服务器中调用此函数(我是 Meteor 新手)。
关于如何实现这一点的任何想法,因为目前它不适用于以下错误:Uncaught TypeError: Accounts.sendVerificationEmail is not a function
注意:Meteor.Accounts.sendVerificationEmail(id);也不起作用(但它确实会产生不同的错误。
【问题讨论】: