Skip to content

Commit

Permalink
updated readme, bumped gem version
Browse files Browse the repository at this point in the history
  • Loading branch information
Max committed Nov 28, 2009
1 parent 9d32558 commit 9bf575b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ begin

Jeweler::Tasks.new do |gemspec|
gemspec.name = 'sinatra-authentication'
gemspec.version = '0.0.5'
gemspec.version = '0.1.0'
gemspec.description = "Simple authentication plugin for sinatra."
gemspec.summary = "Simple authentication plugin for sinatra."
gemspec.homepage = "http://github.com/maxjustus/sinatra-authentication"
Expand All @@ -17,7 +17,9 @@ begin
gemspec.add_dependency "dm-validations"
gemspec.add_dependency "dm-timestamps"
gemspec.add_dependency "rufus-tokyo"
gemspec.add_dependency "sinbook"
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it first!"
end
Expand Down
28 changes: 22 additions & 6 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ with a super secret key, like so:
* get/post '/users/:id/edit'
* get '/users/:id/delete'

## ADDITIONAL ROUTES WHEN USING SINBOOK FOR FACEBOOK INTEGRATION:

* get '/reciever'
* get '/connect'

If you fetch any of the user pages using ajax, they will automatically render without a layout

## HELPER METHODS:
Expand Down Expand Up @@ -94,6 +99,7 @@ and if you want to open a connection with the cabinet directly, you can do somet
## FACEBOOK

# at present, sinatra authentication supports sinbook for interacting with the facebook api.

If you want to allow users to login using facebook, just require 'sinbook' before requiring 'sinatra-authentication'.
The routes '/reciever' and '/connect' will be added. as well as connect links on the login and edit account pages.
You'll still have to include and initialize the facebook connect javascript in your layout yourself, like so:
Expand All @@ -109,13 +115,23 @@ You'll still have to include and initialize the facebook connect javascript in y
:javascript
FB.init("#{fb.api_key}", "/receiver")

Just remember to specify '/reciever' as the path to the xd-receiver file.
Just remember to specify '/reciever' as the path to the xd-receiver file in your call to 'FB.init'.

The render_login_logout helper 'logout' link will log the user out of facebook and your app.

I've also included a little helper method 'render_facebook_connect_link' for rendering the facebook connect link with the correct 'onconnect' javascript callback.
The callback redirects to '/connect' which is important because the way I've implemented facebook connect support is by pinging '/connect' after the user
successfully connects with facebook. If you choose to render the connect button yourself, be sure to have the 'onconnect' callback include "window.location = '/connect'".
'/connect' redirects to '/' on completion.

The 'render_facebook_connect_link' helper uses html instead of fbml, so ajax requests to '/login' or "/users/#{user.id}/edit"
will render the connect link without you needing to parse any fbml.

The render_login_logout helper 'logout' link will log the user out of facebook and the app.
If the user is already logged into the app and connects with facebook via the user edit page,
it adds their fb_uid to their profile in the database.
which will allow them to log in using their email and password, OR their facebook account.

I've also included a little helper method for rendering the facebook connect link with the correct onconnect callback.
This is important because the way I've implemented facebook connect support is by pinging '/connect' after the user
successfully connects with facebook. If the user is already logged into the app and pings connect, it adds their fb_uid to their profile in the database.
If they aren't already logged in to the app through the normal login form,
it creates a new user in the database without an email address or password.
They can add this data by going to "/users/#{current_user.id}/edit"
They can later add this data by going to "/users/#{current_user.id}/edit",
which will allow them to log in using their email address and password, OR their facebook account.
13 changes: 10 additions & 3 deletions sinatra-authentication.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = %q{sinatra-authentication}
s.version = "0.0.5"
s.version = "0.1.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Max Justus Spransy"]
s.date = %q{2009-11-07}
s.date = %q{2009-11-27}
s.description = %q{Simple authentication plugin for sinatra.}
s.email = %q{maxjustus@gmail.com}
s.files = [
Expand All @@ -33,8 +33,10 @@ Gem::Specification.new do |s|
"sinatra-authentication.gemspec",
"test/datamapper_test.rb",
"test/lib/dm_app.rb",
"test/lib/dm_sinbook.rb",
"test/lib/helper.rb",
"test/lib/tc_app.rb",
"test/lib/tc_sinbook.rb",
"test/route_tests.rb",
"test/rufus_tokyo_test.rb"
]
Expand All @@ -44,7 +46,9 @@ Gem::Specification.new do |s|
s.rubygems_version = %q{1.3.5}
s.summary = %q{Simple authentication plugin for sinatra.}
s.test_files = [
"test/lib/tc_app.rb",
"test/lib/dm_sinbook.rb",
"test/lib/tc_app.rb",
"test/lib/tc_sinbook.rb",
"test/lib/helper.rb",
"test/lib/dm_app.rb",
"test/datamapper_test.rb",
Expand All @@ -62,19 +66,22 @@ Gem::Specification.new do |s|
s.add_runtime_dependency(%q<dm-validations>, [">= 0"])
s.add_runtime_dependency(%q<dm-timestamps>, [">= 0"])
s.add_runtime_dependency(%q<rufus-tokyo>, [">= 0"])
s.add_runtime_dependency(%q<sinbook>, [">= 0"])
else
s.add_dependency(%q<sinatra>, [">= 0"])
s.add_dependency(%q<dm-core>, [">= 0"])
s.add_dependency(%q<dm-validations>, [">= 0"])
s.add_dependency(%q<dm-timestamps>, [">= 0"])
s.add_dependency(%q<rufus-tokyo>, [">= 0"])
s.add_dependency(%q<sinbook>, [">= 0"])
end
else
s.add_dependency(%q<sinatra>, [">= 0"])
s.add_dependency(%q<dm-core>, [">= 0"])
s.add_dependency(%q<dm-validations>, [">= 0"])
s.add_dependency(%q<dm-timestamps>, [">= 0"])
s.add_dependency(%q<rufus-tokyo>, [">= 0"])
s.add_dependency(%q<sinbook>, [">= 0"])
end
end

0 comments on commit 9bf575b

Please sign in to comment.