繁体   English   中英

如何在本地工作而不是在Heroku上工作以解决Rails 4中的忘记密码

[英]how to solve forgot password when working on local but not working on heroku for devise in rails 4

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

代码:

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>

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

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

《关于邮件Rails指南》中找到更多详细信息。

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM