在本地工作时如何解决忘记密码但在rails 4中没有使用heroku进行设计

时间:2021-07-31 00:14:06

I am using rails 4 and ruby 2. I have implemented login using devise. My problem is forgot password is not working on heroku but working on local. After receiving the mail when i clicked on "Change my password" link, it redirects to https://www.heroku.com/ page. How can I solve this issue? please help me if any one have any idea.

我正在使用rails 4和ruby 2.我已经使用devise实现了登录。我的问题是忘记密码不能在heroku上工作但在本地工作。当我点击“更改我的密码”链接收到邮件后,它会重定向到https://www.heroku.com/ page。我该如何解决这个问题?如果有任何想法,请帮助我。

Codes:

reset_password_instructions.html.erb:

<p>Hello <%= @resource.email %>!</p>

<p>Someone has requested a link to change your password. You can do this through the link below.</p>

<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @resource.reset_password_token) %></p>

<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

2 个解决方案

#1


Check if you configured your server's url in your config/application.rb:

检查您是否在config / application.rb中配置了服务器的URL:

config.action_mailer.default_url_options = { host: 'your.example.com' }

Find more details in the Rails Guide about Mailers.

有关Mailers的Rails指南中有更多详细信息。

#2


In you config/environments/production.rb file, you should have a looking like

在config / environments / production.rb文件中,您应该看起来像

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

It defines the url used by action mailer when resolving url using the Rails url helpers. So If you set this value or change it, it should change the result.

它定义了动作邮件程序在使用Rails url帮助程序解析URL时使用的URL。因此,如果您设置此值或更改它,它应该更改结果。

#1


Check if you configured your server's url in your config/application.rb:

检查您是否在config / application.rb中配置了服务器的URL:

config.action_mailer.default_url_options = { host: 'your.example.com' }

Find more details in the Rails Guide about Mailers.

有关Mailers的Rails指南中有更多详细信息。

#2


In you config/environments/production.rb file, you should have a looking like

在config / environments / production.rb文件中,您应该看起来像

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

It defines the url used by action mailer when resolving url using the Rails url helpers. So If you set this value or change it, it should change the result.

它定义了动作邮件程序在使用Rails url帮助程序解析URL时使用的URL。因此,如果您设置此值或更改它,它应该更改结果。