ashvin
ashvin

Reputation: 2040

forgot password using devise rails

I am using devise for user in my rails application

When i click on forgot password than it send mail to user for reset password instruction.

but when i click on that password reset link in mail it redirect to my custom user controller which i create for user edit profile...

how to call devise password edit method

below is my controller/users.

class UsersController < ApplicationController
  def edit
    @user = User.find(params[:id])
  end

  def update
    @user = User.find(params[:id])
    if @user.update_attributes(user_params)
       flash[:notice] = "Profile successfully updated"
       redirect_to authenticated_root_path
    else
       render 'edit'
    end
  end

  def change_password
     @user = User.find(current_user.id)
  end

  private
    def user_params
      params.require(:user).permit(:email, :first_name, :last_name, 
         :dob, :address, :zip_code, :about_me, :country_id, :state_id, 
          :city_id, :phone_no, :status, :profile_pic, :gender, 
          :password, :password_confirmation)
      end
 end

Upvotes: 0

Views: 443

Answers (1)

Uday kumar das
Uday kumar das

Reputation: 1613

Use this path for password reset for devise:

edit_user_registration_path

Upvotes: 1

Related Questions