密码重设链接触发Chrome中的“隐私错误”
问题描述:
问题是:当用户从登录页面单击“忘记我的密码”时,会通过链接发送一封电子邮件给他们重置密码,但当他们单击链接在电子邮件中,他们被阻止他们的浏览器访问它。浏览器提供“隐私错误”。密码重设链接触发Chrome中的“隐私错误”
例如,浏览器就会显示Your connection is not private. Attackers might be trying to steal your information from [app_name].heroku.com (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID
这是一个导轨5的应用程序,使用所述设计宝石进行认证,并将其部署到的Heroku。对于这些交易电子邮件,使用SendGrid。在config/environments/production.rb中,config.force_ssl = true
这不会出现在应用程序的任何其他页面上。
是什么导致浏览器发出此警告,我该如何解决?
答
确保您的邮件程序配置为使用https
作为网站网址。更新您的config/environments/production.rb
:
# config/environments/production.rb
Rails.application.configure do
config.action_mailer.default_url_options = { host: 'https://< your domain name>' }
end
您可以将此作为您认为适当添加到其他环境文件。
对于Heroku的,您的主机应该是https://<app_name>.herokuapp.com
是否在电子邮件中使用'http'或'https'该协议的重置密码链接? –
电子邮件中的重置密码链接使用“https”。它遵循格式为https://xxxxxxx.ct.sendgrid.net/wf/click?upn= [very-long-token]'重定向到https:// [app-name] .heroku.com/users/password/edit?reset_password_token = [token]' – koanima
Sendgrid应该重定向到'https:// [app-name] .herokuapp.com' –