Sha256: d666394f7bc9d1c7234764e5a3a56d6a663368c567753aab210fce2af713f728

Contents?: true

Size: 662 Bytes

Versions: 6

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

module Uffizzi
  module AuthHelper
    class << self
      def signed_in?
        config_data_exists? || Uffizzi::Token.exists?
      end

      def sign_out
        Uffizzi::ConfigFile.unset_option(:cookie)
        Uffizzi::ConfigFile.unset_option(:account)
        Uffizzi::ConfigFile.unset_option(:project)
        Uffizzi::Token.delete if Uffizzi::Token.exists?
      end

      private

      def config_data_exists?
        ConfigFile.exists? &&
          ConfigFile.option_has_value?(:account) &&
          ConfigFile.option_has_value?(:cookie) &&
          ConfigFile.option_has_value?(:server)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
uffizzi-cli-2.0.36 lib/uffizzi/auth_helper.rb
uffizzi-cli-2.0.35 lib/uffizzi/auth_helper.rb
uffizzi-cli-2.0.34 lib/uffizzi/auth_helper.rb
uffizzi-cli-2.0.32 lib/uffizzi/auth_helper.rb
uffizzi-cli-2.0.27 lib/uffizzi/auth_helper.rb
uffizzi-cli-2.0.29 lib/uffizzi/auth_helper.rb