在密码重置和帐户激活中发送的链接将在电子邮件中发送,但当我单击它们时,它们不会被重定向到我的Heroku应用程序,并且浏览器停留在"about:blank“。我是不是遗漏了什么?它们看起来像这样:
<a href="https://u1655481.ct.sendgrid.net/wf/click?upn=mvuowIo3LtfxyVBtmnV5znO-2BvLApX4OWlh043PlY34nTdRmVM6vveMB03kyw9RkDUEvA28BSK-2BUBSWODF5yWFrC-2BNt0QPl2osMcVH1xzWtqraK-2BhdDaKAPwzziqS4B54pYcNarDcDTbKmyaLj-2BTSmnoiNl2BT8VqnMMrP7p8su4-3D_MQpxKXFxFonjeh1cARHVt6njcLV6H54PXEoHxOAloIou4oLyvkm9uLyulhz86uohdzxbBJHb-2Bu9ZUCPw-2FkxT7fW8mZO5dW2jHztjZZckPwUqZd9lZaxI8eitFNUyzb6GNUFVejIw76kkAOqYCQ5M4cZXTVJClAoWekh6xUxZ9NUOMK-2B-2Fx5D-2BfOqUmHW462oyh61psTTWPiu0GRg2HpWs0NezfSCN6Kh938A8OJLHBUQ-3D" target="_blank" class="">Reset password</a>
这是我的应用程序/views/user_mailer/password_set.html.erb
<h1>Password reset</h1>
<p>To reset your password click the link below:</p>
<%= link_to "Reset password", edit_password_reset_url(@user.reset_token,
email: @user.email) %>
<p>This link will expire in two hours.</p>
<p>
If you did not request your password to be reset, please ignore this email and
your password will stay as it is.
</p>
发布于 2015-03-03 13:55:22
看起来你传递给SendGrid的URL是http://<your+heroku+app>.herokuapp.com/password_resets/...
,所以你需要确保你指定的是你的应用的名称,而不是http://<your+heroku+app>
。如果您正在使用SMTP,请检查您的config.action_mailer.default_url_options (在config/production.rb
中)是否设置正确:
config.action_mailer.default_url_options = { :host => 'http://appname.herokuapp.com' }
发布于 2015-10-18 23:13:07
当我意识到解决方案时,我也犯了同样的错误,感觉很好笑:
config/environments/production.rb
Listing 10.56host = '<your+heroku+app>.herokuapp.com'
(在我的示例中为host = 'twitterdave.herokuapp.com'
)如果有帮助,请告诉我
https://stackoverflow.com/questions/28824339
复制相似问题