Skip to content

Commit

Permalink
make FailureApp configurable (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
melvinsembrano authored Dec 15, 2022
1 parent 00c9211 commit 01a2020
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/lockie.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'rails'
require 'warden'
require_relative "lockie/rails"
require_relative "lockie/failure_app"
require_relative "lockie/log_helper"
require_relative "lockie/model_helper"
require_relative "lockie/controller_helper"
Expand All @@ -9,7 +10,6 @@
require_relative "lockie/strategies/failed"

module Lockie
autoload :FailureApp, 'lockie/failure_app'

class Configuration
attr_accessor :model_name
Expand All @@ -22,6 +22,7 @@ class Configuration
attr_accessor :scopes
attr_accessor :serializer_to_session, :serializer_from_session
attr_accessor :session_timeout
attr_accessor :failure_app

def initialize
@model_name = "User"
Expand All @@ -34,6 +35,7 @@ def initialize
@serializer_to_session = nil
@serializer_from_session = nil
@session_timeout = 3.hours
@failure_app = Lockie::FailureApp
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/lockie/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Engine < ::Rails::Engine

config.app_middleware.use Warden::Manager do |manager|
manager.default_strategies Lockie.config.default_strategies
manager.failure_app = Lockie::FailureApp
manager.failure_app = Lockie.config.failure_app

if Lockie.config.serialize_session
serializer_to_session = Lockie.config.serializer_to_session || proc { |u| [u.class.name, u.id] }
Expand Down
2 changes: 1 addition & 1 deletion lib/lockie/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Lockie
VERSION = '0.4.5'
VERSION = '0.5.0'
end

0 comments on commit 01a2020

Please sign in to comment.