簡體   English   中英

更改Rails 2中的重置密碼URL

[英]Change Reset password url in Rails 2

Rails:2.3.7 Ruby:1.8.7我想更改重置密碼URL。 我在development.RB中設置了默認URL,但它顯示了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: ronakbhatt@yopmail.com
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.

在下面添加以下代碼

Application_controller

def url_email_reset_password

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

結束

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM