Sha256: ec70cfc0921f5956ee045b5eb67b912169826f3c0defcdb552d49c43c3844ac5

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

require "base64"

module CFoundry
  module LoginHelpers
    def login_prompts
      if @base.uaa
        @base.uaa.prompts
      else
        {
          :username => ["text", "Email"],
          :password => ["password", "Password"]
        }
      end
    end

    def login(username, password)
      @base.token =
        if @base.uaa
          AuthToken.from_uaa_token_info(@base.uaa.authorize(username, password))
        else
          AuthToken.new(@base.create_token({:password => password}, username)[:token])
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cfoundry-0.5.3.rc7 lib/cfoundry/concerns/login_helpers.rb