找到你要的答案

Q:how to solve forgot password when working on local but not working on heroku for devise in rails 4

Q:如何解决忘记密码的工作时在本地而不是工作在Heroku的设计在Rails 4

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.

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>

我使用Rails 4和Ruby 2。我已经实施登录使用设计。我的问题是,忘记密码是不是工作而是工作地方Heroku。接收邮件,当我点击“更改密码”链接后,页面重定向到它https://www.heroku.com/。我该如何解决这个问题?请帮助我,如果任何人有任何想法。

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>
answer1: 回答1:

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

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

Find more details in the Rails Guide about Mailers.

检查如果你配置你的服务器的URL在您的配置/ application.rb:

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

在邮寄的轨导找到更多的细节。

answer2: 回答2:

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

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.

在你的配置/环境/ production.rb文件,你应该有一个像

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

它定义了行动梅勒当解决URL使用Rails URL的URL的帮手。所以,如果你设置这个值或改变它,它应该改变结果。

ruby-on-rails  ruby  ruby-on-rails-4  heroku  devise