Permalink
Browse files

Remove password resets and put it in its own branch

  • Loading branch information...
1 parent 7a8f30b commit 9a31e89f0b2b947855510ba0e60537da2eb7bc54 @binarylogic binarylogic committed Dec 12, 2008
View
48 app/controllers/password_resets_controller.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
View
11 app/models/notifier.rb
@@ -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 app/models/user.rb
@@ -5,7 +5,6 @@ class User < ActiveRecord::Base
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?
View
3 app/views/layouts/application.html.erb
@@ -20,8 +20,7 @@
<% 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 %>
+ <%= link_to "Log In", new_user_session_path %>
<% else %>
<%= link_to "My Account", account_path %> |
<%= link_to "Logout", user_session_path, :method => :delete, :confirm => "Are you sure you want to logout?" %>
View
12 app/views/password_resets/edit.html.erb
@@ -1,12 +0,0 @@
-<h1>Change My Password</h1>
-
-<% form_for @user, :url => password_reset_path, :method => :put do |f| %>
- <%= f.error_messages %>
- <%= f.label :password %><br />
- <%= f.password_field :password %><br />
- <br />
- <%= f.label :password_confirmation %><br />
- <%= f.password_field :password_confirmation %><br />
- <br />
- <%= f.submit "Update my password and log me in" %>
-<% end %>
View
11 app/views/password_resets/new.html.erb
@@ -1,11 +0,0 @@
-<h1>Forgot Password</h1>
-
-Fill out the form below and instructions to reset your password will be emailed to you:<br />
-<br />
-
-<% form_tag password_resets_path do %>
- <label>Email:</label><br />
- <%= text_field_tag "email" %><br />
- <br />
- <%= submit_tag "Reset my password" %>
-<% end %>
View
7 app/views/users/_form.erb
@@ -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 />
View
8 app/views/users/show.html.erb
@@ -1,7 +1,3 @@
-<!--
- 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>
@@ -13,10 +9,6 @@
<%=h @user.openid_identifier %>
</p>
<% end %>
-<p>
- <b>Email:</b>
- <%=h @user.email %>
-</p>
<p>
<b>Login count:</b>
View
1 config/routes.rb
@@ -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"
View
14 db/migrate/20081116172851_add_users_password_reset_fields.rb
@@ -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

0 comments on commit 9a31e89

Please sign in to comment.