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.
- data/lib/entrance/addons/omniauth.rb +10 -5
- data/lib/entrance/addons/sinatra.rb +1 -1
- data/lib/entrance/model.rb +1 -1
- data/lib/entrance/version.rb +1 -1
- metadata +1 -1
@@ -41,11 +41,13 @@ module Entrance
|
|
41
41
|
|
42
42
|
end
|
43
43
|
|
44
|
-
app.include
|
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
|
-
|
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)
|
data/lib/entrance/model.rb
CHANGED
@@ -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 #{
|
30
|
+
raise "Couldn't find '#{field}' in #{self.name} model."
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
data/lib/entrance/version.rb
CHANGED