【发布时间】:2018-08-22 02:21:39
【问题描述】:
我需要查明触发click. event 的用户是否拥有经过验证的电子邮件。如果“真”,他应该被重定向到另一个页面,在那里他可以调用服务器端方法。如果“假”,他应该被重定向到一个页面,在那里他可以单击一个按钮向他重新发送一个新的验证链接。
我尝试使用在其他问题中找到的一些功能,但它不起作用。这是我的点击代码。事件和 if 函数不起作用:
"click. event": function(e){
e.preventDefault();
if (this.userId && Meteor.user().emails[0].verified)
{
Router.go('LinkToCallTheMethod');
}; else
{
console.log('Please verify email first');
Router.go('LinkToResentVerificationLink');
}
});
问题是什么都没有发生。即使我将 emails[0].verified 字段中的布尔值更改为“真”或“假”(没关系,什么都没有发生),用户也不会被重定向,但我也没有收到任何错误代码。
因此我认为问题出在if(...&& Meteor.user().emails[0].verified)。是否有其他方法可以查明电子邮件是否经过验证?
【问题讨论】:
标签: mongodb if-statement meteor routing email-verification