class ConfirmationsController < Devise::ConfirmationsController

  # GET /resource/confirmation?confirmation_token=abcdef
  # hack described by:
  #   https://github.com/plataformatec/devise/pull/2728
  # restore sign_in after confirmation behaviour. More unsafe, but
  # customer satisfaction is dominant here
  def show
    super do |resource|
      sign_in(resource_name, resource) if resource && resource.errors.empty?
    end
  end

  private

  def after_confirmation_path_for(resource_name, resource)
    case resource_name
    when :employee then supplier_root_path(anchor: '/settings')
    else root_path
    end
  end
end
