module Agilib::TokenAuthenticatable

Public Instance Methods

ensure_authentication_token() click to toggle source
# File lib/agilib/token_authenticatable/token_authentication.rb, line 31
def ensure_authentication_token
  if authentication_token.blank?
    self.authentication_token = generate_authentication_token
  end
end
generate_authentication_token() click to toggle source
# File lib/agilib/token_authenticatable/token_authentication.rb, line 37
def generate_authentication_token
  loop do
    token = Devise.friendly_token
    break token unless User.where(authentication_token: token).first
  end
end