You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: confirmations_controller.rb
    path of file: ./repos/consuldemocracy/app/controllers/users
    
    the code of the file until where you have to start completion: class Users::ConfirmationsController < Devise::ConfirmationsController
  # POST /resource/confirmation
  def create
    self.resource = resource_class.send_confirmation_instructions(resource_params)
    yield resource if block_given?

    if successfully_sent?(resource)
      Mailer.already_confirmed(resource).deliver_later unless resource.confirmation_required?
      respond_with({}, location: after_resending_confirmation_instr
    
  def show
    # In the default implementation, this already confirms the resource:
    # self.resource = self.resource = resource_class.confirm_by_token(params[:confirmation_token])
    self.resource = resource_class.find_by!(confirmation_token: params[:confirmation_token])

    yield resource if block_given?

    # New condition added to if: when no password was given, display the "show" view
    # (which uses "update" above)
    if resource.encrypted_password.blank?
      respond_with_navigational(resource) { render :show }
    elsif resource.errors.empty?
      set_official_position if resource.has_official_email?

      if resource.confirm
        set_flash_message(:notice, :confirmed) if is_flashing_format?

        respond_with_navigational(resource) do
          redirect_to after_confirmation_path_for(resource_name, resource)
        end
      else
        respond_with_navigational(resource.errors, status: :unprocessable_entity) do
          render :new, status: :unprocessable_entity
        end
      end