Meteor:重新发送电子邮件验证链接

时间:2015-11-14 14:23:20

标签: meteor email-verification

我希望能够向我的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是一个服务器功能,但我不知道如何在点击验证邮件链接(我是一个流星新手)时在服务器中调用此功能。

了解如何完成此操作,因为目前它无法解决以下错误:Uncaught TypeError: Accounts.sendVerificationEmail is not a function

注意:Meteor.Accounts.sendVerificationEmail(id);也不起作用(但确实会产生不同的错误。

1 个答案:

答案 0 :(得分:1)

您可以尝试使用服务器端方法,只需创建一个传递attrs并在服务器上调用http://docs.meteor.com/#/full/accounts_sendverificationemail。有关流星方法的更多信息:http://docs.meteor.com/#/full/meteor_methods

相关问题