简体   繁体   English

设计可重新配置,使用单独的邮件模板重新确认电子邮件?

[英]Devise reconfirmable, use a separate mail template for reconfirmation emails?

Devise supports the reconfirmable option, when users change email they have to confirm new email. Devise支持可重新配置选项,当用户更改电子邮件时,他们必须确认新电子邮件。

However the standard confirm mail template is used. 但是,使用标准确认邮件模板。 I would like to use a separate mail template for emails that have to be reconfirmed. 我想为必须重新确认的电子邮件使用单独的邮件模板。

devise's registrations_controller.rb: devise的registrations_controller.rb:

  def update

    self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
    prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)

    if resource.update_with_password(resource_params)
      if is_navigational_format?
        flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
            :update_needs_confirmation : :updated
        set_flash_message :notice, flash_key
      end
      sign_in resource_name, resource, :bypass => true
      respond_with resource, :location => after_update_path_for(resource)
    else
      clean_up_passwords resource
      respond_with resource
    end
  end

Anyone knows where to hook into Devise to let it use a separate email text for reconfirmable emails instead of using the default confirm text? 任何人都知道在哪里挂钩Devise让它使用单独的电子邮件文本来重新确认电子邮件,而不是使用默认的确认文本?

Have a look at this question: 看看这个问题:

How to send two different emails for devise confirmable and devise reconfirmable? 如何发送两个不同的电子邮件用于设计确认和设计可重新配置?

You should have access to @resource.pending_reconfirmation? 您应该有权访问@resource.pending_reconfirmation? in the devise confirmation_instructions mailer. 在设计confirm_instructions邮件。

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

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