获取设计身份验证以发送电子邮件以进行密码检索 [英] Getting Devise authentication to send the email for password retrieval

查看:51
本文介绍了获取设计身份验证以发送电子邮件以进行密码检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在本地主机上测试为 Rails 设计身份验证,并希望它发送电子邮件以检索密码(即忘记密码"链接).密码检索内置于 Devise 中,只需对其进行正确配置即可发送电子邮件.

I'm testing Devise authentication for Rails on my local host and want to get it to send emails for password retrieval (i.e. the "forgot your password" link). Password retrieval is built into Devise, it's just a matter of configuring it properly to get the email to send.

在 initializers/devise.rb 中,我把

In initializers/devise.rb, I put

config.mailer_sender = "i...@mydomain.com" 

但是当我尝试在为 Rails 设计身份验证时测试忘记密码"链接时,我收到以下错误消息.如果我确实需要为要实际发送的电子邮件添加其他信息,我需要添加什么以及在哪里添加?

but when I tried to test the "forgot your password" link on Devise authentication for rails I got the error message below. If I do need to add other information for the email to actually send, what do I need to add and where??

在用户模型中,这些是正在使用的模块设计 :database_authenticable, :registerable,:recoverable, :rememberable, :trackable, :validatable

In users model, these are the modules that are being used devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

--- 错误信息---设计中的错误::ECONNREFUSED::PasswordsController#create连接被拒绝 - 连接(2)Rails.root:/Users/myname/Sites/rails3d应用程序跟踪 |框架跟踪 |完整跟踪要求参数:{"utf8"=>"✓","authenticity_token"=>"8oO5vXqO4esl3ztn5yE7OkVxZe+Ju94jj76rbKR225I=","user"=>{"email"=>"myemail...@gmail.com"},提交"=>给我发送重置密码说明"}显示会话转储显示环境转储回复标题

--- error message --- Errno::ECONNREFUSED in Devise::PasswordsController#create Connection refused - connect(2) Rails.root: /Users/myname/Sites/rails3d Application Trace | Framework Trace | Full Trace Request Parameters: {"utf8"=>"✓", "authenticity_token"=>"8oO5vXqO4esl3ztn5yE7OkVxZe+Ju94jj76rbKR225I=", "user"=>{"email"=>"myemail...@gmail.com"}, "commit"=>"Send me reset password instructions"} Show session dump Show env dump Response Headers

推荐答案

您是否在 environment/development.rb 中设置了邮件设置

HAve you setup your mail settings in environments/development.rb

  config.action_mailer.smtp_settings = {
     :address              => "smtp.gmail.com",
     :port                 => 587,
     :domain               => 'domain.com',
     :user_name            => 'email_address@domain.com',
     :password             => 'password',
     :authentication       => :plain,
     :enable_starttls_auto => true  }

这篇关于获取设计身份验证以发送电子邮件以进行密码检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆