Question

Devise supports the reconfirmable option, when users change email they have to confirm new email.

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:

  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?

Was it helpful?

Solution

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? in the devise confirmation_instructions mailer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top