在 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
结束
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
结束