onBeforeAction:如何检查邮件验证



我试图检查电子邮件是否在onBeforeAction钩子内的路由器上进行验证,但它抛出2个错误。你知道如何解决这两个问题吗?

错误1:

Exception in callback of async function: .onBeforeAction@http://localhost:3000/lib/router.js?5f85a874ea86a78deb8c19a394c27e00c5a5f753:34:9
错误2:

Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction?

代码:

onBeforeAction: function () {
    if (Meteor.user()) {
        var user = Meteor.user();
        if (!user.emails[0].verified) { // line 34
            Router.go('confirmEmail');
        } else if (!user.gamertagScanned) {
            Router.go('confirmGt');
        } else {
            this.next();
        }
    } else {
        this.render('aboutUs');
    }
},

你不应该在onBeforeAction内做Router.go() -我怀疑你想要this.render('confirmEmail')this.render('confirmGt')

最新更新