sinatra-authentication 0.1.0 → 0.1.1
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/Rakefile +1 -1
- data/lib/models/abstract_user.rb +1 -1
- data/lib/models/rufus_tokyo_user.rb +13 -3
- data/readme.markdown +6 -2
- data/sinatra-authentication.gemspec +2 -2
- data/test/lib/tc_sinbook.rb +2 -2
- metadata +2 -2
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
|
7
7
|
Jeweler::Tasks.new do |gemspec|
|
8
8
|
gemspec.name = 'sinatra-authentication'
|
9
|
-
gemspec.version = '0.1.
|
9
|
+
gemspec.version = '0.1.1'
|
10
10
|
gemspec.description = "Simple authentication plugin for sinatra."
|
11
11
|
gemspec.summary = "Simple authentication plugin for sinatra."
|
12
12
|
gemspec.homepage = "http://github.com/maxjustus/sinatra-authentication"
|
data/lib/models/abstract_user.rb
CHANGED
@@ -4,7 +4,7 @@ if Object.const_defined?("DataMapper")
|
|
4
4
|
require 'dm-validations'
|
5
5
|
require Pathname(__FILE__).dirname.expand_path + "datamapper_user.rb"
|
6
6
|
require Pathname(__FILE__).dirname.expand_path + "dm_adapter.rb"
|
7
|
-
elsif Object.const_defined?("Rufus")
|
7
|
+
elsif Object.const_defined?("Rufus") && Rufus.const_defined?("Tokyo")
|
8
8
|
require Pathname(__FILE__).dirname.expand_path + "rufus_tokyo_user.rb"
|
9
9
|
require Pathname(__FILE__).dirname.expand_path + "tc_adapter.rb"
|
10
10
|
end
|
@@ -36,9 +36,9 @@ class TcUser
|
|
36
36
|
def self.query(&block)
|
37
37
|
connection = TcUserTable.new
|
38
38
|
result_set = connection.query(&block)
|
39
|
-
result_set.collect
|
39
|
+
output = result_set.collect { |result_hash| TcUser.new(result_hash) }
|
40
40
|
connection.close
|
41
|
-
|
41
|
+
output
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.get(key)
|
@@ -153,7 +153,17 @@ class TcUser
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
-
|
156
|
+
if Rufus::Tokyo.const_defined?('Table')
|
157
|
+
class TokyoTableDad < Rufus::Tokyo::Table
|
158
|
+
end
|
159
|
+
elsif Rufus::Edo.const_defined?('Table')
|
160
|
+
class TokyoTableDad < Rufus::Edo::Table
|
161
|
+
end
|
162
|
+
else
|
163
|
+
throw 'wtf?'
|
164
|
+
end
|
165
|
+
|
166
|
+
class TcUserTable < TokyoTableDad
|
157
167
|
@@path = false
|
158
168
|
def initialize
|
159
169
|
#make this path configurable somehow
|
data/readme.markdown
CHANGED
@@ -120,8 +120,12 @@ Just remember to specify '/reciever' as the path to the xd-receiver file in your
|
|
120
120
|
The render_login_logout helper 'logout' link will log the user out of facebook and your app.
|
121
121
|
|
122
122
|
I've also included a little helper method 'render_facebook_connect_link' for rendering the facebook connect link with the correct 'onconnect' javascript callback.
|
123
|
-
The callback redirects to '/connect'
|
124
|
-
|
123
|
+
The callback redirects to '/connect'.
|
124
|
+
This is important because the way I've implemented facebook connect support is by pinging '/connect' after the user
|
125
|
+
successfully connects with facebook.
|
126
|
+
|
127
|
+
If you choose to render the connect button yourself, be sure to have the 'onconnect' callback include "window.location = '/connect'".
|
128
|
+
|
125
129
|
'/connect' redirects to '/' on completion.
|
126
130
|
|
127
131
|
The 'render_facebook_connect_link' helper uses html instead of fbml, so ajax requests to '/login' or "/users/#{user.id}/edit"
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra-authentication}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Max Justus Spransy"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-12-05}
|
13
13
|
s.description = %q{Simple authentication plugin for sinatra.}
|
14
14
|
s.email = %q{maxjustus@gmail.com}
|
15
15
|
s.files = [
|
data/test/lib/tc_sinbook.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Justus Spransy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-05 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|