Permalink
Browse files

Removed all password resets and openid code and put them in their own…

… branch
  • Loading branch information...
1 parent 32eaec9 commit d1cf131a86d578041e8f58b0caafbda3ab499d71 @binarylogic committed Dec 12, 2008
Showing with 13 additions and 1,206 deletions.
  1. +0 −48 app/controllers/password_resets_controller.rb
  2. +5 −15 app/controllers/user_sessions_controller.rb
  3. +0 −11 app/models/notifier.rb
  4. +1 −26 app/models/user.rb
  5. +0 −1 app/views/layouts/application.html.erb
  6. +0 −5 app/views/notifier/password_reset_instructions.erb
  7. +5 −17 app/views/user_sessions/new.html.erb
  8. +0 −10 app/views/users/_form.erb
  9. +2 −17 app/views/users/show.html.erb
  10. +0 −1 config/routes.rb
  11. +0 −14 db/migrate/20081116172851_add_users_password_reset_fields.rb
  12. +0 −19 db/migrate/20081119233359_add_users_openid_field.rb
  13. +0 −20 db/migrate/20081120163933_create_openid_tables.rb
  14. +0 −35 vendor/plugins/open_id_authentication/CHANGELOG
  15. +0 −218 vendor/plugins/open_id_authentication/README
  16. +0 −22 vendor/plugins/open_id_authentication/Rakefile
  17. +0 −11 ...uthentication/generators/open_id_authentication_tables/open_id_authentication_tables_generator.rb
  18. +0 −20 ...or/plugins/open_id_authentication/generators/open_id_authentication_tables/templates/migration.rb
  19. +0 −26 ...ns/open_id_authentication/generators/upgrade_open_id_authentication_tables/templates/migration.rb
  20. +0 −11 ...nerators/upgrade_open_id_authentication_tables/upgrade_open_id_authentication_tables_generator.rb
  21. +0 −17 vendor/plugins/open_id_authentication/init.rb
  22. +0 −176 vendor/plugins/open_id_authentication/lib/open_id_authentication.rb
  23. +0 −9 vendor/plugins/open_id_authentication/lib/open_id_authentication/association.rb
  24. +0 −55 vendor/plugins/open_id_authentication/lib/open_id_authentication/db_store.rb
  25. +0 −73 vendor/plugins/open_id_authentication/lib/open_id_authentication/mem_cache_store.rb
  26. +0 −5 vendor/plugins/open_id_authentication/lib/open_id_authentication/nonce.rb
  27. +0 −17 vendor/plugins/open_id_authentication/lib/open_id_authentication/request.rb
  28. +0 −20 vendor/plugins/open_id_authentication/lib/open_id_authentication/timeout_fixes.rb
  29. +0 −30 vendor/plugins/open_id_authentication/tasks/open_id_authentication_tasks.rake
  30. +0 −151 vendor/plugins/open_id_authentication/test/mem_cache_store_test.rb
  31. +0 −32 vendor/plugins/open_id_authentication/test/normalize_test.rb
  32. +0 −46 vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb
  33. +0 −14 vendor/plugins/open_id_authentication/test/status_test.rb
  34. +0 −14 vendor/plugins/open_id_authentication/test/test_helper.rb
@@ -1,48 +0,0 @@
-class PasswordResetsController < ApplicationController
- before_filter :load_user_using_perishable_token, :only => [:edit, :update]
- before_filter :require_no_user
-
- def new
- render
- end
-
- def create
- @user = User.find_by_email(params[:email])
- if @user
- @user.deliver_password_reset_instructions!
- flash[:notice] = "Instructions to reset your password have been emailed to you. " +
- "Please check your email."
- redirect_to root_url
- else
- flash[:notice] = "No user was found with that email address"
- render :action => :new
- end
- end
-
- def edit
- render
- end
-
- def update
- @user.password = params[:user][:password]
- @user.password_confirmation = params[:user][:password_confirmation]
- if @user.save
- flash[:notice] = "Password successfully updated"
- redirect_to account_url
- else
- render :action => :edit
- end
- end
-
- private
- def load_user_using_perishable_token
- @user = User.find_using_perishable_token(params[:id])
- unless @user
- flash[:notice] = "We're sorry, but we could not locate your account." +
- "If you are having issues try copying and pasting the URL " +
- "from your email into your browser or restarting the " +
- "reset password process."
- redirect_to root_url
- end
- end
-end
@@ -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,11 +0,0 @@
-class Notifier < ActionMailer::Base
- default_url_options[:host] = "authlogicexample.binarylogic.com"
-
- def password_reset_instructions(user)
- subject "Password Reset Instructions"
- from "Binary Logic Notifier <noreply@binarylogic.com>"
- recipients user.email
- sent_on Time.now
- body :edit_password_reset_url => edit_password_reset_url(user.perishable_token)
- end
-end
View
@@ -1,28 +1,3 @@
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
-
- 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
+ acts_as_authentic
end
@@ -21,7 +21,6 @@
<% if !current_user %>
<%= link_to "Register", new_account_path %> |
<%= link_to "Log In", new_user_session_path %> |
- <%= link_to "Forgot password", new_password_reset_path %>
<% else %>
<%= link_to "My Account", account_path %> |
<%= link_to "Logout", user_session_path, :method => :delete, :confirm => "Are you sure you want to logout?" %>
@@ -1,5 +0,0 @@
-A request to reset your password has been made. If you did not make this request, simply ignore this email. If you did make this request just click the link below:
-
-<%= @edit_password_reset_url %>
-
-If the above URL does not work try copying and pasting it into your browser. If you continue to have problem please feel free to contact us.
@@ -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 />
View
@@ -6,14 +6,4 @@
<br />
<%= 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,21 +1,6 @@
-<!--
- 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>Email:</b>
- <%=h @user.email %>
+ <b>Login:</b>
+ <%=h @user.login %>
</p>
<p>
View
@@ -1,6 +1,5 @@
ActionController::Routing::Routes.draw do |map|
map.resource :account, :controller => "users"
- map.resources :password_resets
map.resources :users
map.resource :user_session
map.root :controller => "user_sessions", :action => "new"
@@ -1,14 +0,0 @@
-class AddUsersPasswordResetFields < ActiveRecord::Migration
- def self.up
- add_column :users, :perishable_token, :string, :default => "", :null => false
- add_column :users, :email, :string, :default => "", :null => false
-
- add_index :users, :perishable_token
- add_index :users, :email
- end
-
- def self.down
- remove_column :users, :perishable_token
- remove_column :users, :email
- end
-end
@@ -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.

0 comments on commit d1cf131

Please sign in to comment.