Accounts.validateLoginAttempt 打破用户在刷新后保持登录状态
Accounts.validateLoginAttempt breaks user staying logged in after refresh
我使用 Google recaptcha 来验证用户不是机器人,这部分有效! :)
我用
Accounts.validateLoginAttempt((data) => {
if (someThingThatWillValidateTrueIfUserIsLoggedIn) {
return true // Will not run google Captcha security messure..
}
}
向 google 发出我的 post 请求以验证 public。我想我的问题是我应该立即从 validateLoginAttempt 使用什么来 return true。如果我删除 validateLoginAttempt,用户将在刷新后保持登录状态。
我试过使用
Accounts.user() // Undef
Meteor.user() // Undef
this.connection // Undef
this.userId // Undef
但运气不好...我如何使用 validateLoginAttempt 并保持用户在浏览器刷新后保持登录状态的能力?
好吧,这花了一段时间才弄清楚:(,事实是一个帐户参数也包含简历数据,所以这样做
Accounts.validateLoginAttempt((data) => {
if (data.type === 'resume' && data.allowed) {
return true;
}
... code for doing captcha check..
}
很好用!! :)
我使用 Google recaptcha 来验证用户不是机器人,这部分有效! :)
我用
Accounts.validateLoginAttempt((data) => {
if (someThingThatWillValidateTrueIfUserIsLoggedIn) {
return true // Will not run google Captcha security messure..
}
}
向 google 发出我的 post 请求以验证 public。我想我的问题是我应该立即从 validateLoginAttempt 使用什么来 return true。如果我删除 validateLoginAttempt,用户将在刷新后保持登录状态。
我试过使用
Accounts.user() // Undef
Meteor.user() // Undef
this.connection // Undef
this.userId // Undef
但运气不好...我如何使用 validateLoginAttempt 并保持用户在浏览器刷新后保持登录状态的能力?
好吧,这花了一段时间才弄清楚:(,事实是一个帐户参数也包含简历数据,所以这样做
Accounts.validateLoginAttempt((data) => {
if (data.type === 'resume' && data.allowed) {
return true;
}
... code for doing captcha check..
}
很好用!! :)