代码之家  ›  专栏  ›  技术社区  ›  Cisum Inas

账户validateLoginAttempt中断用户在刷新后保持登录状态

  •  1
  • Cisum Inas  · 技术社区  · 7 年前

    我使用

    Accounts.validateLoginAttempt((data) => {
     if (someThingThatWillValidateTrueIfUserIsLoggedIn) {
       return true // Will not run google Captcha security messure..
     }
    
    }
    

    我试过使用

    Accounts.user() // Undef
    
    Meteor.user() // Undef
    
    this.connection // Undef
    
    this.userId // Undef
    

    但是没有运气。。。如何使用validateLoginAttempt并在浏览器刷新后保持用户登录的能力?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Cisum Inas    7 年前

    Accounts.validateLoginAttempt((data) => {
        if (data.type === 'resume' && data.allowed) {
          return true;
        }
       ... code for doing captcha check..
    }
    

    效果很好!!:)