我使用Google recaptcha来验证用户不是机器人,这部分有效! :)
我用
Accounts.validateLoginAttempt((data) => {
if (someThingThatWillValidateTrueIfUserIsLoggedIn) {
return true // Will not run google Captcha security messure..
}
}
将我的帖子请求发送到谷歌以验证公众。我想我的问题是我应该使用什么来从validateLoginAttempt返回真正的imediatly。如果我删除validateLoginAttempt,用户将在刷新后保持登录状态。
我尝试使用
Accounts.user() // Undef
Meteor.user() // Undef
this.connection // Undef
this.userId // Undef
但没有运气......我如何使用validateLoginAttempt并保持用户在浏览器刷新后保持登录的能力?
答案 0 :(得分:0)
嗯,这需要一段时间来弄明白:(事实上,一个Accounts参数包含了恢复数据,所以这样做
Accounts.validateLoginAttempt((data) => {
if (data.type === 'resume' && data.allowed) {
return true;
}
... code for doing captcha check..
}
效果很好!! :)