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: invitations_controller.rb
    path of file: ./repos/limestone-accounts/app/controllers/users
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Users
  class InvitationsController < Devise::InvitationsController
    # Invitations Controller has it's own token based authentication
    before_action :skip_authorization, only: %i(edit update)

    def new
      authorize :invitation
      super
    end

    def create
      authorize :invitation
      emails = params[:user][:email].split(',').map(&:strip)
      results = UserInvitationService.mass_invite!(current_account, emails, cu
    
    def create
      authorize :invitation
      emails = params[:user][:email].split(',').map(&:strip)
      results = UserInvitationService.mass_invite!(current_account, emails, current_user)
      users_failed = results[:users_failed]
      success_count = results[:users_successful].size
      success_msg = "#{success_count} #{'member'.pluralize(success_count)} successfully invited."
      flash[:success] = success_msg unless success_count.zero?
      if users_failed.any?
        failure_count = users_failed.size
        failure_msg = "#{failure_count} #{'member'.pluralize(failure_count)} failed to be invited."
        flash.merge!( error: failure_msg, emails_failed: users_failed )
      end