entrance 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,11 +41,13 @@ module Entrance
41
41
 
42
42
  end
43
43
 
44
- app.include ::Entrance::Controller # provides redirects, etc
44
+ app.send(:include, Entrance::Controller) # provides redirects, etc
45
45
 
46
46
  app.use ::OmniAuth::Builder do
47
47
  # this is run after the app has initialized, so it's safe to use it here.
48
- ::OmniAuth.config.test_mode = true if app.settings.auth_test?
48
+ if app.settings.respond_to?(:auth_test)
49
+ ::OmniAuth.config.test_mode = true if app.settings.auth_test?
50
+ end
49
51
 
50
52
  app.settings.auth_providers.each do |name, options|
51
53
  # puts "Initializing #{name} provider: #{options.inspect}"
@@ -73,6 +75,10 @@ module Entrance
73
75
 
74
76
  end # get, post
75
77
 
78
+ app.get '/auth/failure' do
79
+ redirect_with('/', :error, params[:message])
80
+ end
81
+
76
82
  end # registered
77
83
 
78
84
  def logger
@@ -91,9 +97,8 @@ module Entrance
91
97
  end
92
98
 
93
99
  def can_authenticate_with?(service)
94
- return true if OmniAuth.config.test_mode and service.to_sym == :default
95
-
96
- options.auth_providers.keys.map(&:to_sym).include?(service.to_sym)
100
+ return true if ::OmniAuth.config.test_mode and service.to_sym == :default
101
+ settings.auth_providers.keys.map(&:to_sym).include?(service.to_sym)
97
102
  end
98
103
 
99
104
  def find_user_with_username(username)
@@ -6,7 +6,7 @@ module Entrance
6
6
 
7
7
  def self.registered(app)
8
8
 
9
- app.include ::Entrance::Controller
9
+ app.send(:include, ::Entrance::Controller)
10
10
 
11
11
  app.get '/login' do
12
12
  if logged_in?
@@ -27,7 +27,7 @@ module Entrance
27
27
  %w(username_attr password_attr).each do |key|
28
28
  field = Entrance.config.send(key)
29
29
  unless fields.include?(field.to_sym)
30
- raise "Couldn't find '#{field}' in #{base.name} model."
30
+ raise "Couldn't find '#{field}' in #{self.name} model."
31
31
  end
32
32
  end
33
33
 
@@ -1,7 +1,7 @@
1
1
  module Entrance
2
2
  MAJOR = 0
3
3
  MINOR = 3
4
- PATCH = 3
4
+ PATCH = 4
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entrance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: