Sha256: c79f90736b35de8a176f66fa94dee6effd67c08060e75ddf5836870a2c5f7348

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

require "devise/token_authenticatable/strategy"

module Devise
  module TokenAuthenticatable

    # Authentication token params key name of choice. E.g. /users/sign_in?some_key=...
    mattr_accessor :token_authentication_key
    @@token_authentication_key = :auth_token

    # Token expiration period. E.g. 1.day
    mattr_accessor :token_expires_in
    @@token_expires_in = nil

    # Defines if the authentication token is reset before the model is saved.
    mattr_accessor :should_reset_authentication_token
    @@should_reset_authentication_token = false

    # Defines if the authentication token is set - if not already - before the model is saved.
    mattr_accessor :should_ensure_authentication_token
    @@should_ensure_authentication_token = false

    # Enable the configuration of the TokenAuthenticatable
    # strategy with a block:
    #
    #   Devise::TokenAuthenticatable.setup do |config|
    #     config.token_authentication_key = :other_key
    #   end
    #
    def self.setup
      yield self
    end
  end
end

# Register TokenAuthenticatable module in Devise.
Devise::add_module  :token_authenticatable,
                    model: 'devise/token_authenticatable/model',
                    strategy: true,
                    no_input: true

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
devise-token_authenticatable-1.1.0 lib/devise/token_authenticatable.rb
devise-token_authenticatable-1.0.2 lib/devise/token_authenticatable.rb
devise-token_authenticatable-1.0.1 lib/devise/token_authenticatable.rb
devise-token_authenticatable-1.0.0 lib/devise/token_authenticatable.rb
devise-token_authenticatable-0.5.3 lib/devise/token_authenticatable.rb
devise-token_authenticatable-0.5.2 lib/devise/token_authenticatable.rb
devise-token_authenticatable-0.5.1 lib/devise/token_authenticatable.rb
devise-token_authenticatable-0.4.10 lib/devise/token_authenticatable.rb
devise-token_authenticatable-0.5.0 lib/devise/token_authenticatable.rb
devise-token_authenticatable-0.4.9 lib/devise/token_authenticatable.rb