sinatra-authentication 0.2.1 → 0.2.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/Rakefile +1 -1
- data/lib/models/abstract_user.rb +1 -1
- data/lib/models/rufus_tokyo_user.rb +2 -2
- data/lib/sinatra-authentication.rb +14 -2
- data/lib/views/index.haml +1 -1
- data/lib/views/login.haml +5 -3
- data/lib/views/show.haml +1 -1
- data/lib/views/signup.haml +6 -1
- data/readme.markdown +1 -1
- data/sinatra-authentication.gemspec +1 -1
- metadata +1 -1
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.2.
|
9
|
+
gemspec.version = '0.2.2'
|
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
|
elsif Object.const_defined?("MongoMapper")
|
@@ -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)
|
@@ -225,8 +225,20 @@ module Sinatra
|
|
225
225
|
end
|
226
226
|
|
227
227
|
if Sinatra.const_defined?('FacebookObject')
|
228
|
-
def render_facebook_connect_link(text = 'Login using facebook')
|
229
|
-
|
228
|
+
def render_facebook_connect_link(text = 'Login using facebook', options = {:size => 'small'})
|
229
|
+
if options[:size] == 'small'
|
230
|
+
size = 'Small'
|
231
|
+
elsif options[:size] == 'medium'
|
232
|
+
size = 'Medium'
|
233
|
+
elsif options[:size] == 'large'
|
234
|
+
size = 'Large'
|
235
|
+
elsif options[:size] == 'xlarge'
|
236
|
+
size = 'BigPun'
|
237
|
+
else
|
238
|
+
size = 'Small'
|
239
|
+
end
|
240
|
+
|
241
|
+
%[<a href="#" onclick="FB.Connect.requireSession(function(){document.location = '/connect';}); return false;" class="fbconnect_login_button FBConnectButton FBConnectButton_#{size}">
|
230
242
|
<span id="RES_ID_fb_login_text" class="FBConnectButton_Text">
|
231
243
|
#{text}
|
232
244
|
</span>
|
data/lib/views/index.haml
CHANGED
data/lib/views/login.haml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#sinatra_authentication
|
2
|
-
%h1 Login
|
2
|
+
%h1.page_title Login
|
3
3
|
%form{:action => "/login", :method => "post"}
|
4
4
|
.field
|
5
5
|
.label
|
@@ -13,6 +13,8 @@
|
|
13
13
|
%input{:value => "login", :type => "submit"}
|
14
14
|
%a{:href => "/signup", :class => 'sinatra_authentication_link'}
|
15
15
|
Signup
|
16
|
-
|
16
|
+
.third_party_signup
|
17
|
+
%h3.section_title One click login:
|
18
|
+
.login_link.facebook_login
|
17
19
|
- if Sinatra.const_defined?('FacebookObject')
|
18
|
-
= render_facebook_connect_link
|
20
|
+
= render_facebook_connect_link('Login using facebook', :size => 'large')
|
data/lib/views/show.haml
CHANGED
data/lib/views/signup.haml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#sinatra_authentication
|
2
|
-
%h1 Signup
|
2
|
+
%h1.page_title Signup
|
3
3
|
%form{:action => "/signup", :method => "post"}
|
4
4
|
.field
|
5
5
|
.label
|
@@ -17,3 +17,8 @@
|
|
17
17
|
%input{ :value => "Create account", :type => "submit" }
|
18
18
|
%a{:href => "/login", :class => 'sinatra_authentication_link'}
|
19
19
|
Login
|
20
|
+
.third_party_signup
|
21
|
+
%h3.section_title One click signup:
|
22
|
+
.login_link.facebook_login
|
23
|
+
- if Sinatra.const_defined?('FacebookObject')
|
24
|
+
= render_facebook_connect_link('Signup using facebook', :size => 'large')
|
data/readme.markdown
CHANGED