module Devise::Models::TokenAuthenticatable

def self.required_fields(klass)

def self.required_fields(klass)
  [:authentication_token]
end

def after_token_authentication

Hook called after token authentication.
def after_token_authentication
end

def ensure_authentication_token

Generate authentication token unless already exists.
def ensure_authentication_token
  reset_authentication_token if authentication_token.blank?
end

def ensure_authentication_token!

Generate authentication token unless already exists and save the record.
def ensure_authentication_token!
  reset_authentication_token! if authentication_token.blank?
end

def expire_auth_token_on_timeout

def expire_auth_token_on_timeout
  self.class.expire_auth_token_on_timeout
end

def reset_authentication_token

Generate new authentication token (a.k.a. "single access token").
def reset_authentication_token
  self.authentication_token = self.class.authentication_token
end

def reset_authentication_token!

Generate new authentication token and save the record.
def reset_authentication_token!
  reset_authentication_token
  save(:validate => false)
end