Sha256: 52d7d215e9030488ed0538e91a12c4a004ffc61aa19eb230288bbd140e759fd9

Contents?: true

Size: 955 Bytes

Versions: 73

Compression:

Stored size: 955 Bytes

Contents

class PasswordResetsController < ApplicationController

  def index
  end

  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, :ma_notice => "Email sent with password reset instructions."
  end

  def edit
    ## Deprecated syntax in rail 5
    ##@user = User.find_by_password_reset_token!(params[:id])
    @user = User.where(:password_reset_token => params[:id]).first
  end

  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 &crarr;
      reset has expired."
    elsif @user.update_attributes(params[:user])
      redirect_to root_url, :notice => "Password has been reset."
    else
      render :edit
    end
  end

end

Version data entries

73 entries across 70 versions & 3 rubygems

Version Path
jinda-0.8.0 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.8.0 test/dummy/app/controllers/password_resets_controller.rb
jinda-0.7.7.4 test/dummy/app/controllers/password_resets_controller.rb
jinda-0.7.7.4 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.7.3 test/dummy/app/controllers/password_resets_controller.rb
jinda-0.7.7.3 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.7.2 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.7.1 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda_mind-1.0.0 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.7 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.6 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.5.5 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.5.4 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.5.3 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.5.2 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.5.0 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.3 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.2 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.1 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.7.0.4 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb