Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 22, 2021. It is now read-only.

Conversation

@muZk
Copy link

@muZk muZk commented Jul 9, 2020

You can't have multiple entities where one of them has permanent tokens. This configuration would fail:

      Knock.token_lifetime = {
        user: nil,
        admin: 7.days,
      }

Because token_lifetime method assumes that if this is a hash, the values are dates/datetime:

def token_lifetime
      return unless verify_lifetime?

      if Knock.token_lifetime.is_a?(Hash)
        Knock.token_lifetime[entity_class_name].from_now.to_i // <---- here
      else
        Knock.token_lifetime.from_now.to_i
      end
end

This PR fixes the issue by updating verify_lifetime? method.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant