Module: DoorkeeperApplicationsHelper

Defined in:
app/helpers/doorkeeper_applications_helper.rb

Instance Method Summary collapse

Instance Method Details

#token_expiry_string(token) ⇒ Object



2
3
4
5
6
7
8
# File 'app/helpers/doorkeeper_applications_helper.rb', line 2

def token_expiry_string(token)
  return t(".revoked") if token.revoked?
  return t(".never") if token.expires_in.nil?
  expires_at = token.created_at + token.expires_in
  return t(".expired") if expires_at < Time.now.utc
  distance_of_time_in_words(Time.now.utc, expires_at)
end

#token_fingerprint(token) ⇒ Object



10
11
12
# File 'app/helpers/doorkeeper_applications_helper.rb', line 10

def token_fingerprint(token)
  Digest::SHA256.hexdigest(token.token).first(8)
end