Sha256: b63c027331dfbaa7f0f2093b6b77fc21efc904af8887039a53411566f908b4af

Contents?: true

Size: 976 Bytes

Versions: 10

Compression:

Stored size: 976 Bytes

Contents

class PasswordResetsController < ApplicationController

  def index
  end

  def create
    #user = User.find_by_email(params[:email])
    user = Jinda::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 = Jinda::User.where(:password_reset_token => params[:id]).first
  end

  def update
    ##@user = User.find_by_password_reset_token!(params[:id])
    @user = Jinda::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

10 entries across 10 versions & 1 rubygems

Version Path
jinda-0.4.3 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.4.2 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.4.1 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.4.0 lib/generators/jinda/templates/app/controllers/jinda_org/password_resets_controller.rb
jinda-0.3.9 lib/generators/jinda/templates/app/controllers/jinda-org/password_resets_controller.rb
jinda-0.3.8 lib/generators/jinda/templates/app/controllers/password_resets_controller.rb
jinda-0.3.7 lib/generators/jinda/templates/app/controllers/password_resets_controller.rb
jinda-0.3.6 lib/generators/jinda/templates/app/controllers/password_resets_controller.rb
jinda-0.3.5 lib/generators/jinda/templates/app/controllers/password_resets_controller.rb
jinda-0.3.4 lib/generators/jinda/templates/app/controllers/password_resets_controller.rb