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 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.1'
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"
@@ -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! { |result_hash| TcUser.new(result_hash) }
39
+ output = result_set.collect { |result_hash| TcUser.new(result_hash) }
40
40
  connection.close
41
- result_set
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
- %[<a href="#" onclick="FB.Connect.requireSession(function(){document.location = '/connect';}); return false;" class="fbconnect_login_button FBConnectButton FBConnectButton_Small">
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
@@ -1,5 +1,5 @@
1
1
  #sinatra_authentication
2
- %h1 Users
2
+ %h1.page_title Users
3
3
  %table
4
4
  %tr
5
5
  %th
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
- .facebook_login
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
@@ -1,5 +1,5 @@
1
1
  #sinatra_authentication
2
- %h1
2
+ %h1.page_title
3
3
  - if @user.email
4
4
  = @user.email
5
5
  - elsif @user.fb_uid
@@ -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
@@ -1,4 +1,4 @@
1
- ### a little sinatra gem that implements user authentication, with support for both datamapper and rufus-tokyo
1
+ ### A little sinatra gem that implements user authentication, with support for datamapper, mongomapper and rufus-tokyo
2
2
 
3
3
  ## INSTALLATION:
4
4
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra-authentication}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
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"]
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.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Justus Spransy