Permalink
Browse files

Remove OpenID code and put it in its own branch

  • Loading branch information...
1 parent 7a8f30b commit abfbcb4f2c52ddb4478609ab886ed36564b13698 @binarylogic committed Dec 12, 2008
Showing with 16 additions and 1,150 deletions.
  1. +5 −15 app/controllers/user_sessions_controller.rb
  2. +1 −21 app/models/user.rb
  3. +0 −34 app/models/user_session.rb
  4. +5 −17 app/views/user_sessions/new.html.erb
  5. +0 −7 app/views/users/_form.erb
  6. +5 −15 app/views/users/show.html.erb
  7. +0 −19 db/migrate/20081119233359_add_users_openid_field.rb
  8. +0 −20 db/migrate/20081120163933_create_openid_tables.rb
  9. +0 −35 vendor/plugins/open_id_authentication/CHANGELOG
  10. +0 −218 vendor/plugins/open_id_authentication/README
  11. +0 −22 vendor/plugins/open_id_authentication/Rakefile
  12. +0 −11 ...uthentication/generators/open_id_authentication_tables/open_id_authentication_tables_generator.rb
  13. +0 −20 ...or/plugins/open_id_authentication/generators/open_id_authentication_tables/templates/migration.rb
  14. +0 −26 ...ns/open_id_authentication/generators/upgrade_open_id_authentication_tables/templates/migration.rb
  15. +0 −11 ...nerators/upgrade_open_id_authentication_tables/upgrade_open_id_authentication_tables_generator.rb
  16. +0 −17 vendor/plugins/open_id_authentication/init.rb
  17. +0 −176 vendor/plugins/open_id_authentication/lib/open_id_authentication.rb
  18. +0 −9 vendor/plugins/open_id_authentication/lib/open_id_authentication/association.rb
  19. +0 −55 vendor/plugins/open_id_authentication/lib/open_id_authentication/db_store.rb
  20. +0 −73 vendor/plugins/open_id_authentication/lib/open_id_authentication/mem_cache_store.rb
  21. +0 −5 vendor/plugins/open_id_authentication/lib/open_id_authentication/nonce.rb
  22. +0 −17 vendor/plugins/open_id_authentication/lib/open_id_authentication/request.rb
  23. +0 −20 vendor/plugins/open_id_authentication/lib/open_id_authentication/timeout_fixes.rb
  24. +0 −30 vendor/plugins/open_id_authentication/tasks/open_id_authentication_tasks.rake
  25. +0 −151 vendor/plugins/open_id_authentication/test/mem_cache_store_test.rb
  26. +0 −32 vendor/plugins/open_id_authentication/test/normalize_test.rb
  27. +0 −46 vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb
  28. +0 −14 vendor/plugins/open_id_authentication/test/status_test.rb
  29. +0 −14 vendor/plugins/open_id_authentication/test/test_helper.rb
@@ -8,21 +8,11 @@ def new
def create
@user_session = UserSession.new(params[:user_session])
- # We are saving with a block to accomodate for OpenID authentication
- # If you are not using OpenID you can save without a block:
- #
- # if @user_session.save
- # # ... successful login
- # else
- # # ... unsuccessful login
- # end
- @user_session.save do |result|
- if result
- flash[:notice] = "Login successful!"
- redirect_back_or_default account_url
- else
- render :action => :new
- end
+ if @user_session.save
+ flash[:notice] = "Login successful!"
+ redirect_back_or_default account_url
+ else
+ render :action => :new
end
end
View
@@ -1,28 +1,8 @@
class User < ActiveRecord::Base
- # ALL of the following code is for OpenID integration. If you are not using OpenID in your app
- # just remove all of the following code, to the point where you User class is completely blank.
- acts_as_authentic :login_field_validation_options => {:if => :openid_identifier_blank?}, :password_field_validation_options => {:if => :openid_identifier_blank?}
-
- validate :normalize_openid_identifier
- validates_uniqueness_of :openid_identifier, :allow_blank => true
- validates_length_of :email, :minimum => 500, :unless => "true"
-
- # For acts_as_authentic configuration
- def openid_identifier_blank?
- openid_identifier.blank?
- end
+ acts_as_authentic
def deliver_password_reset_instructions!
reset_perishable_token!
Notifier.deliver_password_reset_instructions(self)
end
-
- private
- def normalize_openid_identifier
- begin
- self.openid_identifier = OpenIdAuthentication.normalize_url(openid_identifier) if !openid_identifier.blank?
- rescue OpenIdAuthentication::InvalidOpenId => e
- errors.add(:openid_identifier, e.message)
- end
- end
end
@@ -1,36 +1,2 @@
class UserSession < Authlogic::Session::Base
- # ALL of the following code is for OpenID integration. If you are not using OpenID in your app
- # just remove all of the following code, to the point where you UserSession class is completely blank.
- attr_accessor :openid_identifier
-
- def authenticating_with_openid?
- !openid_identifier.blank? || controller.params[:open_id_complete]
- end
-
- def save(&block)
- if authenticating_with_openid?
- raise ArgumentError.new("You must supply a block to authenticate with OpenID") unless block_given?
-
- controller.send(:authenticate_with_open_id, openid_identifier) do |result, openid_identifier|
- if !result.successful?
- errors.add_to_base(result.message)
- yield false
- return
- end
-
- record = klass.find_by_openid_identifier(openid_identifier)
-
- if !record
- errors.add(:openid_identifier, "did not match any users in our database, have you set up your account to use OpenID?")
- yield false
- return
- end
-
- self.unauthorized_record = record
- super
- end
- else
- super
- end
- end
end
@@ -2,23 +2,11 @@
<% form_for @user_session, :url => user_session_path do |f| %>
<%= f.error_messages %>
- <div id="login_container"<% unless @user_session.openid_identifier.blank? %> style="display: none;"<% end %>>
- <%= f.label :login %> (or <%= link_to_function "login using OpenID", "$('login_container').toggle(); $('openid_container').toggle();" %>)<br />
- <%= f.text_field :login %><br />
- <br />
- <%= f.label :password %><br />
- <%= f.password_field :password %><br />
- </div>
- <!--
- Notice the following is for OpenID. If you are not implementing OpenID in your app, simply remove the following <div> block.
- Also, notice the <div id="login_container"> above, those fields do not need to be wrapped in a <div>, you can remove that as well.
- I apologize if this makes it a little confusing, I have been building this app with a number of tutorials and one of them has been
- OpenID integration.
- -->
- <div id="openid_container"<% if @user_session.openid_identifier.blank? %> style="display: none;"<% end %>>
- <%= f.label :openid_identifier, "OpenID" %> (or <%= link_to_function "login using a standard username / password", "$('login_container').toggle(); $('openid_container').toggle();" %>)<br /><br />
- <%= f.text_field :openid_identifier %><br />
- </div>
+ <%= f.label :login %><br />
+ <%= f.text_field :login %><br />
+ <br />
+ <%= f.label :password %><br />
+ <%= f.password_field :password %><br />
<br />
<%= f.check_box :remember_me %><%= f.label :remember_me %><br />
<br />
@@ -7,13 +7,6 @@
<%= form.label :password_confirmation %><br />
<%= form.password_field :password_confirmation %><br />
<br />
-<!--
- The following is for OpenID integration, if you are not using OpenID in your app
- simple remove the :openid_identifier label and field
--->
-<%= form.label :openid_identifier, "Or use OpenID instead of a standard login / password" %><br />
-<%= form.text_field :openid_identifier %><br />
-<br />
<%= form.label :email %><br />
<%= form.text_field :email %><br />
<br />
@@ -1,18 +1,8 @@
-<!--
- The following is for OpenID, if you are not using OpenID in your app remove
- the OpenID if statement and field below.
--->
-<% if @user.openid_identifier.blank? %>
- <p>
- <b>Login:</b>
- <%=h @user.login %>
- </p>
-<% else %>
- <p>
- <b>OpenID:</b>
- <%=h @user.openid_identifier %>
- </p>
-<% end %>
+<p>
+ <b>Login:</b>
+ <%=h @user.login %>
+</p>
+
<p>
<b>Email:</b>
<%=h @user.email %>
@@ -1,19 +0,0 @@
-class AddUsersOpenidField < ActiveRecord::Migration
- def self.up
- add_column :users, :openid_identifier, :string
- add_index :users, :openid_identifier
-
- change_column :users, :login, :string, :default => nil, :null => true
- change_column :users, :crypted_password, :string, :default => nil, :null => true
- change_column :users, :password_salt, :string, :default => nil, :null => true
- end
-
- def self.down
- remove_column :users, :openid_identifier
-
- [:login, :crypted_password, :password_salt].each do |field|
- User.all(:conditions => "#{field} is NULL").each { |user| user.update_attribute(field, "") if user.send(field).nil? }
- change_column :users, field, :string, :default => "", :null => false
- end
- end
-end
@@ -1,20 +0,0 @@
-class CreateOpenidTables < ActiveRecord::Migration
- def self.up
- create_table :open_id_authentication_associations, :force => true do |t|
- t.integer :issued, :lifetime
- t.string :handle, :assoc_type
- t.binary :server_url, :secret
- end
-
- create_table :open_id_authentication_nonces, :force => true do |t|
- t.integer :timestamp, :null => false
- t.string :server_url, :null => true
- t.string :salt, :null => false
- end
- end
-
- def self.down
- drop_table :open_id_authentication_associations
- drop_table :open_id_authentication_nonces
- end
-end
@@ -1,35 +0,0 @@
-* Fake HTTP method from OpenID server since they only support a GET. Eliminates the need to set an extra route to match the server's reply. [Josh Peek]
-
-* OpenID 2.0 recommends that forms should use the field name "openid_identifier" rather than "openid_url" [Josh Peek]
-
-* Return open_id_response.display_identifier to the application instead of .endpoints.claimed_id. [nbibler]
-
-* Add Timeout protection [Rick]
-
-* An invalid identity url passed through authenticate_with_open_id will no longer raise an InvalidOpenId exception. Instead it will return Result[:missing] to the completion block.
-
-* Allow a return_to option to be used instead of the requested url [Josh Peek]
-
-* Updated plugin to use Ruby OpenID 2.x.x [Josh Peek]
-
-* Tied plugin to ruby-openid 1.1.4 gem until we can make it compatible with 2.x [DHH]
-
-* Use URI instead of regexps to normalize the URL and gain free, better matching #8136 [dkubb]
-
-* Allow -'s in #normalize_url [Rick]
-
-* remove instance of mattr_accessor, it was breaking tests since they don't load ActiveSupport. Fix Timeout test [Rick]
-
-* Throw a InvalidOpenId exception instead of just a RuntimeError when the URL can't be normalized [DHH]
-
-* Just use the path for the return URL, so extra query parameters don't interfere [DHH]
-
-* Added a new default database-backed store after experiencing trouble with the filestore on NFS. The file store is still available as an option [DHH]
-
-* Added normalize_url and applied it to all operations going through the plugin [DHH]
-
-* Removed open_id? as the idea of using the same input box for both OpenID and username has died -- use using_open_id? instead (which checks for the presence of params[:openid_url] by default) [DHH]
-
-* Added OpenIdAuthentication::Result to make it easier to deal with default situations where you don't care to do something particular for each error state [DHH]
-
-* Stop relying on root_url being defined, we can just grab the current url instead [DHH]
Oops, something went wrong. Retry.

0 comments on commit abfbcb4

Please sign in to comment.