0

Rails:2.3.7 Ruby:1.8.7 I want to change reset password URL. I set default URL in development.RB but it shows localhost.

  def create
    @user = User.find_by_email(params[:email])
    if @user
      @user.deliver_perishable_email!(:password_reset_instructions)
      flash[:notice] = "Check your email for password reset instructions."
      redirect_to root_url
    else
      flash[:notice] = "No user was found with that email address."
      render :action => :new
    end
  end

Development.rb

config.action_mailer.default_url_options = { :host => "http://*****.com" }

O/p

    Date: Tue, 8 Aug 2017 16:50:25 +0530
To: [email protected]
Subject: Your [Pyromaniac] password reset instructions
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8

A request to reset your password has been made. If you did not make this request, simply ignore this email. If you did make this request just click the link below:


http://localhost:3000/password_resets/NgaNMcvuJ_2D1Ol4nF4A/edit


If the above URL does not work try copying and pasting it into your browser. If you continue to have the problem, please feel free to contact us.

1 Answer 1

1

Add the below code in

Application_controller

def url_email_reset_password

 ActionMailer::Base.default_url_options[:host] pointing to localhost:3000

end

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.