class PasswordResetsController

Public Instance Methods

create() click to toggle source
# File lib/generators/jinda/templates/app/controllers/jinda_org/password_resets.rb, line 3
def create
  ##user = User.find_by_email(params[:email])
  user = User.where(:email => params[:email]).first

  user.send_password_reset if user
  redirect_to root_url, :notice => "Email sent with password reset instructions."
end
edit() click to toggle source
# File lib/generators/jinda/templates/app/controllers/jinda_org/password_resets.rb, line 11
def edit
  ##@user = User.find_by_password_reset_token!(params[:id])
  @user = User.where(:password_reset_token => params[:id]).first
end
index() click to toggle source
# File lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb, line 3
def index
end
update() click to toggle source
# File lib/generators/jinda/templates/app/controllers/jinda_org/password_resets.rb, line 16
def update
  ##@user = User.find_by_password_reset_token!(params[:id])
  @user = User.where(:password_reset_token => params[:id]).first
  if @user.password_reset_sent_at < 2.hours.ago
    redirect_to new_password_reset_path, :alert => "Password reset has expired."
  elsif @user.update_attributes(params[:user])
    redirect_to root_url, :notice => "Password has been reset!"
  else
    render :edit
  end
end