entrance 0.4.1 → 0.4.2
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 +3 -4
- data/lib/entrance/addons/sinatra.rb +22 -0
- data/lib/entrance/version.rb +1 -1
- metadata +1 -1
@@ -44,16 +44,15 @@ module Entrance
|
|
44
44
|
app.send(:include, Entrance::Controller) # provides redirects, etc
|
45
45
|
|
46
46
|
app.use ::OmniAuth::Builder do
|
47
|
-
# this is run after the app has initialized, so it's safe to
|
47
|
+
# this is run only once after the app has initialized, so it's safe to set it here.
|
48
48
|
if app.settings.respond_to?(:auth_test)
|
49
49
|
::OmniAuth.config.test_mode = true if app.settings.auth_test?
|
50
50
|
end
|
51
51
|
|
52
52
|
app.settings.auth_providers.each do |name, options|
|
53
53
|
# puts "Initializing #{name} provider: #{options.inspect}"
|
54
|
-
|
55
|
-
opts
|
56
|
-
provider(name, *opts)
|
54
|
+
opts = options || {}
|
55
|
+
provider(name, opts[:key], opts[:secret], opts[:extra] || {})
|
57
56
|
end
|
58
57
|
end
|
59
58
|
|
@@ -1,4 +1,26 @@
|
|
1
1
|
require 'entrance'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
=begin
|
5
|
+
|
6
|
+
Simple login/signup support for sinatra. This extension
|
7
|
+
expects a login.erb and a signup.erb (unless disabled) to
|
8
|
+
be present in a views/public directory.
|
9
|
+
|
10
|
+
Once a user logs in, he or she will be redirected to /.
|
11
|
+
|
12
|
+
require 'sinatra/base'
|
13
|
+
require 'entrance/sinatra'
|
14
|
+
|
15
|
+
class Hello < Sinatra::Base
|
16
|
+
register Entrance::Sinatra
|
17
|
+
|
18
|
+
before do
|
19
|
+
login_required :except => ['/login', '/signup'] # or just /login if you don't want signups
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
=end
|
2
24
|
|
3
25
|
module Entrance
|
4
26
|
|
data/lib/entrance/version.rb
CHANGED