【问题标题】:Meteor: Resend email verification linkMeteor:重新发送电子邮件验证链接
【发布时间】: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);也不起作用(但它确实会产生不同的错误。

【问题讨论】:

    标签: meteor email-verification


    【解决方案1】:

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

    【讨论】:

    • 感谢您为我指明了正确的方向,这就像一个魅力:)
    猜你喜欢
    • 2017-09-09
    • 2018-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-03
    • 1970-01-01
    相关资源
    最近更新 更多