Sha256: eb19b72909913442a61716d3783fec2c10edd27c3c42c8bdbe5dabb70ab5bc8e

Contents?: true

Size: 908 Bytes

Versions: 5

Compression:

Stored size: 908 Bytes

Contents

class Wepay::AuthorizeController < Wepay::ApplicationController

  def index
    wepay_gateway = WepayRails::Payments::Gateway.new

    # For security purposes, stop people from hitting this page and resetting the access_token.
    if wepay_gateway.configuration[:access_token].present?
      render :text => "You have already specified an access token in wepay.yml. If you wish to change it, please delete the current one and try again."
      return
    end

    if params[:code].present?
      access_token = wepay_gateway.get_access_token(params[:code], redirect_uri)
      render :text => "Copy this access token, #{access_token} to the access_token directive in your wepay.yml and restart your app."
    else
      redirect_to wepay_gateway.auth_code_url redirect_uri
    end
  end

  private
  def redirect_uri
    "#{WepayRails::Configuration.settings[:root_callback_uri]}/wepay/authorize"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wepay-rails-2.6.0 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.5.2 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.5.1 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.5.0 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.2.9 app/controllers/wepay/authorize_controller.rb