Permalink
Browse files

merge with master

  • Loading branch information...
2 parents 83dc11d + e6218b3 commit cd985667dba8f99ee7d22ddf8bf9437573fbca37 @stepheneb stepheneb committed Jul 27, 2010
Showing with 1,726 additions and 563 deletions.
  1. +9 −1 CHANGELOG.rdoc
  2. +1 −0 Gemfile
  3. +9 −1 Gemfile.lock
  4. +224 −42 README.rdoc
  5. +2 −0 TODO
  6. +1 −1 app/controllers/devise/confirmations_controller.rb
  7. +4 −0 app/controllers/devise/oauth_callbacks_controller.rb
  8. +1 −1 app/controllers/devise/passwords_controller.rb
  9. +16 −1 app/controllers/devise/registrations_controller.rb
  10. +1 −1 app/controllers/devise/unlocks_controller.rb
  11. +6 −0 app/views/devise/shared/_links.erb
  12. +4 −0 config/locales/en.yml
  13. +19 −8 devise.gemspec
  14. +91 −35 lib/devise.rb
  15. +78 −59 lib/devise/controllers/helpers.rb
  16. +18 −6 lib/devise/controllers/internal_helpers.rb
  17. +4 −6 lib/devise/controllers/scoped_views.rb
  18. +3 −5 lib/devise/controllers/url_helpers.rb
  19. +8 −2 lib/devise/failure_app.rb
  20. +0 −14 lib/devise/models.rb
  21. +7 −8 lib/devise/models/authenticatable.rb
  22. +10 −10 lib/devise/models/confirmable.rb
  23. +9 −10 lib/devise/models/database_authenticatable.rb
  24. +7 −6 lib/devise/models/lockable.rb
  25. +49 −0 lib/devise/models/oauthable.rb
  26. +4 −2 lib/devise/models/recoverable.rb
  27. +13 −0 lib/devise/models/registerable.rb
  28. +13 −14 lib/devise/models/rememberable.rb
  29. +9 −2 lib/devise/models/timeoutable.rb
  30. +3 −4 lib/devise/models/token_authenticatable.rb
  31. +9 −2 lib/devise/models/validatable.rb
  32. +14 −8 lib/devise/modules.rb
  33. +41 −0 lib/devise/oauth.rb
  34. +33 −0 lib/devise/oauth/config.rb
  35. +28 −0 lib/devise/oauth/helpers.rb
  36. +190 −0 lib/devise/oauth/internal_helpers.rb
  37. +29 −0 lib/devise/oauth/test_helpers.rb
  38. +35 −0 lib/devise/oauth/url_helpers.rb
  39. +23 −42 lib/devise/rails.rb
  40. +14 −13 lib/devise/rails/routes.rb
  41. +0 −7 lib/devise/rails/warden_compat.rb
  42. +0 −9 lib/devise/schema.rb
  43. +1 −1 lib/devise/version.rb
  44. +3 −3 lib/generators/devise/install_generator.rb
  45. +1 −1 lib/generators/devise/orm_helpers.rb
  46. +0 −4 lib/generators/devise_install_generator.rb
  47. +0 −4 lib/generators/devise_views_generator.rb
  48. 0 lib/generators/{devise → }/templates/README
  49. +17 −13 lib/generators/{devise → }/templates/devise.rb
  50. +7 −42 test/controllers/helpers_test.rb
  51. +11 −7 test/controllers/internal_helpers_test.rb
  52. +2 −1 test/controllers/url_helpers_test.rb
  53. +57 −67 test/integration/authenticatable_test.rb
  54. +295 −0 test/integration/oauthable_test.rb
  55. +16 −4 test/integration/registerable_test.rb
  56. +1 −1 test/integration/rememberable_test.rb
  57. +21 −0 test/models/oauthable_test.rb
  58. +3 −3 test/models/rememberable_test.rb
  59. +2 −2 test/models/validatable_test.rb
  60. +44 −0 test/oauth/config_test.rb
  61. +47 −0 test/oauth/url_helpers_test.rb
  62. +4 −1 test/rails_app/app/active_record/admin.rb
  63. +5 −4 test/rails_app/app/active_record/user.rb
  64. +5 −0 test/rails_app/app/controllers/home_controller.rb
  65. +3 −2 test/rails_app/app/mongoid/admin.rb
  66. +5 −1 test/rails_app/app/mongoid/shim.rb
  67. +3 −6 test/rails_app/app/mongoid/user.rb
  68. +4 −0 test/rails_app/app/views/home/index.html.erb
  69. +11 −0 test/rails_app/config/initializers/devise.rb
  70. +2 −1 test/rails_app/config/routes.rb
  71. +19 −17 test/rails_app/db/migrate/20100401102949_create_tables.rb
  72. +17 −51 test/rails_app/db/schema.rb
  73. +7 −0 test/rails_app/lib/shared_admin.rb
  74. +48 −0 test/rails_app/lib/shared_user.rb
  75. +24 −2 test/routes_test.rb
  76. +0 −5 test/support/test_silencer.rb
  77. +2 −0 test/test_helper.rb
View
@@ -1,4 +1,12 @@
-== 1.1.0 (to be released)
+* enhancements
+ * Added OAuth 2 support
+
+== 1.1.1
+
+* bugfix
+ * Fix a small bug where generated locale file was empty on devise:install
+
+== 1.1.0
* enhancements
* Rememberable module allows user to be remembered across browsers and is enabled by default (by github.com/trevorturk)
View
@@ -26,3 +26,4 @@ gem "warden", "0.10.7"
gem "webrat", "0.7.0"
gem "mocha", :require => false
gem "bcrypt-ruby", :require => "bcrypt"
+gem "oauth2"
View
@@ -61,6 +61,7 @@ GEM
activerecord-jdbcsqlite3-adapter (0.9.7-java)
activerecord-jdbc-adapter (= 0.9.7)
jdbc-sqlite3 (>= 3.6.3.054)
+ addressable (2.1.2)
arel (0.4.0)
activesupport (>= 3.0.0.beta)
bcrypt-ruby (2.1.2)
@@ -70,6 +71,9 @@ GEM
columnize (0.3.1)
erubis (2.6.6)
abstract (>= 1.0.0)
+ faraday (0.4.6)
+ addressable (>= 2.1.1)
+ rack (>= 1.0.1)
i18n (0.4.1)
jdbc-sqlite3 (3.6.3.054)
linecache (0.43)
@@ -82,9 +86,13 @@ GEM
rake
mongo (1.0.5)
bson (>= 1.0.4)
+ multi_json (0.0.4)
nokogiri (1.4.2-java)
weakling (>= 0.0.3)
nokogiri (1.4.2)
+ oauth2 (0.0.10)
+ faraday (~> 0.4.1)
+ multi_json (>= 0.0.4)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.9)
@@ -104,7 +112,6 @@ GEM
tzinfo (0.3.22)
warden (0.10.7)
rack (>= 1.0.0)
- weakling (0.0.4-java)
webrat (0.7.0)
nokogiri (>= 1.2.0)
rack (>= 1.0)
@@ -122,6 +129,7 @@ DEPENDENCIES
mocha
mongo
mongoid!
+ oauth2
rails!
ruby-debug (>= 0.10.3)
sqlite3-ruby
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
2 TODO
@@ -1,3 +1,5 @@
* Move integration tests to Capybara
* Better ORM integration
* Extract activatable models tests from confirmable
+* Add support to automatically refresh the access token for OAuth
+* Add test to generators using the new Rails::Generators::TestCase
@@ -3,7 +3,7 @@ class Devise::ConfirmationsController < ApplicationController
# GET /resource/confirmation/new
def new
- build_resource
+ build_resource({})
render_with_scope :new
end
@@ -0,0 +1,4 @@
+class Devise::OauthCallbacksController < ApplicationController
+ include Devise::Controllers::InternalHelpers
+ include Devise::Oauth::InternalHelpers
+end
@@ -4,7 +4,7 @@ class Devise::PasswordsController < ApplicationController
# GET /resource/password/new
def new
- build_resource
+ build_resource({})
render_with_scope :new
end
@@ -1,5 +1,5 @@
class Devise::RegistrationsController < ApplicationController
- prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
+ prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ]
prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy]
include Devise::Controllers::InternalHelpers
@@ -45,8 +45,23 @@ def destroy
sign_out_and_redirect(self.resource)
end
+ # GET /resource/cancel
+ # Forces the session data which is usually expired after sign
+ # in to be expired now.
+ def cancel
+ expire_session_data_after_sign_in!
+ redirect_to new_registration_path(resource_name)
+ end
+
protected
+ # Build a devise resource passing in the session. Useful to move
+ # temporary session data to the newly created user.
+ def build_resource(hash=nil)
+ hash ||= params[resource_name] || {}
+ self.resource = resource_class.new_with_session(hash, session)
+ end
+
# Authenticates the current scope and gets a copy of the current resource.
# We need to use a copy because we don't want actions like update changing
# the current user in place.
@@ -4,7 +4,7 @@ class Devise::UnlocksController < ApplicationController
# GET /resource/unlock/new
def new
- build_resource
+ build_resource({})
render_with_scope :new
end
@@ -17,3 +17,9 @@
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end -%>
+
+<%- if devise_mapping.oauthable? %>
+ <%- resource_class.oauth_providers.each do |provider| %>
+ <%= link_to "Sign in with #{provider.to_s.titleize}", oauth_authorize_url(resource_name, provider) %><br />
+ <% end =%>
+<% end -%>
View
@@ -30,6 +30,10 @@ en:
unlocks:
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
unlocked: 'Your account was successfully unlocked. You are now signed in.'
+ oauth_callbacks:
+ success: 'Successfully authorized from %{kind} account.'
+ failure: 'Could not authorize you from %{kind} because "%{reason}".'
+ skipped: 'Skipped Oauth authorization for %{kind}.'
mailer:
confirmation_instructions:
subject: 'Confirmation instructions'
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{devise}
- s.version = "1.1.0"
+ s.version = "1.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jos\303\251 Valim", "Carlos Ant\303\264nio"]
- s.date = %q{2010-07-06}
+ s.date = %q{2010-07-27}
s.description = %q{Flexible authentication solution for Rails with Warden}
s.email = %q{contact@plataformatec.com.br}
s.extra_rdoc_files = [
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
"Rakefile",
"TODO",
"app/controllers/devise/confirmations_controller.rb",
+ "app/controllers/devise/oauth_callbacks_controller.rb",
"app/controllers/devise/passwords_controller.rb",
"app/controllers/devise/registrations_controller.rb",
"app/controllers/devise/sessions_controller.rb",
@@ -70,6 +71,7 @@ Gem::Specification.new do |s|
"lib/devise/models/confirmable.rb",
"lib/devise/models/database_authenticatable.rb",
"lib/devise/models/lockable.rb",
+ "lib/devise/models/oauthable.rb",
"lib/devise/models/recoverable.rb",
"lib/devise/models/registerable.rb",
"lib/devise/models/rememberable.rb",
@@ -78,6 +80,12 @@ Gem::Specification.new do |s|
"lib/devise/models/trackable.rb",
"lib/devise/models/validatable.rb",
"lib/devise/modules.rb",
+ "lib/devise/oauth.rb",
+ "lib/devise/oauth/config.rb",
+ "lib/devise/oauth/helpers.rb",
+ "lib/devise/oauth/internal_helpers.rb",
+ "lib/devise/oauth/test_helpers.rb",
+ "lib/devise/oauth/url_helpers.rb",
"lib/devise/orm/active_record.rb",
"lib/devise/orm/mongoid.rb",
"lib/devise/path_checker.rb",
@@ -97,12 +105,10 @@ Gem::Specification.new do |s|
"lib/generators/devise/devise_generator.rb",
"lib/generators/devise/install_generator.rb",
"lib/generators/devise/orm_helpers.rb",
- "lib/generators/devise/templates/README",
- "lib/generators/devise/templates/devise.rb",
"lib/generators/devise/views_generator.rb",
- "lib/generators/devise_install_generator.rb",
- "lib/generators/devise_views_generator.rb",
- "lib/generators/mongoid/devise_generator.rb"
+ "lib/generators/mongoid/devise_generator.rb",
+ "lib/generators/templates/README",
+ "lib/generators/templates/devise.rb"
]
s.homepage = %q{http://github.com/plataformatec/devise}
s.rdoc_options = ["--charset=UTF-8"]
@@ -121,6 +127,7 @@ Gem::Specification.new do |s|
"test/integration/database_authenticatable_test.rb",
"test/integration/http_authenticatable_test.rb",
"test/integration/lockable_test.rb",
+ "test/integration/oauthable_test.rb",
"test/integration/recoverable_test.rb",
"test/integration/registerable_test.rb",
"test/integration/rememberable_test.rb",
@@ -134,13 +141,16 @@ Gem::Specification.new do |s|
"test/models/confirmable_test.rb",
"test/models/database_authenticatable_test.rb",
"test/models/lockable_test.rb",
+ "test/models/oauthable_test.rb",
"test/models/recoverable_test.rb",
"test/models/rememberable_test.rb",
"test/models/timeoutable_test.rb",
"test/models/token_authenticatable_test.rb",
"test/models/trackable_test.rb",
"test/models/validatable_test.rb",
"test/models_test.rb",
+ "test/oauth/config_test.rb",
+ "test/oauth/url_helpers_test.rb",
"test/orm/active_record.rb",
"test/orm/mongoid.rb",
"test/rails_app/app/active_record/admin.rb",
@@ -170,11 +180,12 @@ Gem::Specification.new do |s|
"test/rails_app/config/routes.rb",
"test/rails_app/db/migrate/20100401102949_create_tables.rb",
"test/rails_app/db/schema.rb",
+ "test/rails_app/lib/shared_admin.rb",
+ "test/rails_app/lib/shared_user.rb",
"test/routes_test.rb",
"test/support/assertions.rb",
"test/support/helpers.rb",
"test/support/integration.rb",
- "test/support/test_silencer.rb",
"test/support/webrat/integrations/rails.rb",
"test/test_helper.rb",
"test/test_helpers_test.rb"
Oops, something went wrong.

0 comments on commit cd98566

Please sign in to comment.