Sha256: 6ee9b2f829abd0b0a32ad377f35eec73fcd7e3648290ca7d22e49e6fc707fe09

Contents?: true

Size: 1.25 KB

Versions: 40

Compression:

Stored size: 1.25 KB

Contents

CheckoutController.class_eval do
  before_filter :check_authorization
  before_filter :check_registration, :except => [:registration, :update_registration]

  helper :users

  def registration
    @user = User.new
  end

  def update_registration
    # hack - temporarily change the state to something other than cart so we can validate the order email address
    current_order.state = "address"
    if current_order.update_attributes(params[:order])
      redirect_to checkout_path
    else
      @user = User.new
      render 'registration'
    end
  end

  private
  def check_authorization
    authorize!(:edit, current_order, session[:access_token])
  end

  # Introduces a registration step whenever the +registration_step+ preference is true.
  def check_registration
    return unless Spree::Auth::Config[:registration_step]
    return if current_user or current_order.email
    store_location
    redirect_to checkout_registration_path
  end

  # Overrides the equivalent method defined in spree_core.  This variation of the method will ensure that users
  # are redirected to the tokenized order url unless authenticated as a registered user.
  def completion_route
    return order_path(@order) if current_user
    token_order_path(@order, @order.token)
  end

end

Version data entries

40 entries across 40 versions & 7 rubygems

Version Path
spree_auth-0.70.7 app/controllers/checkout_controller_decorator.rb
spree_auth-0.70.6 app/controllers/checkout_controller_decorator.rb
apispree_auth-0.0.0 app/controllers/checkout_controller_decorator.rb
My-Commerce_auth-1.1.0 app/controllers/checkout_controller_decorator.rb
My-Commerce_auth-1.0.0 app/controllers/checkout_controller_decorator.rb
MyCommerceapi-1.0.0 auth/app/controllers/checkout_controller_decorator.rb
MyCommerce-0.0.3 auth/app/controllers/checkout_controller_decorator.rb
rfcommerce_auth-0.0.3 app/controllers/checkout_controller_decorator.rb
spree_auth-0.60.6 app/controllers/checkout_controller_decorator.rb
spree_auth-0.70.5 app/controllers/checkout_controller_decorator.rb
spree_auth-0.70.4 app/controllers/checkout_controller_decorator.rb
spree_auth-0.60.5 app/controllers/checkout_controller_decorator.rb
spree_auth-0.70.3 app/controllers/checkout_controller_decorator.rb
spree_auth-0.70.2 app/controllers/checkout_controller_decorator.rb
spree_auth-0.40.4 app/controllers/checkout_controller_decorator.rb
spree_auth-0.50.4 app/controllers/checkout_controller_decorator.rb
spree_auth-0.60.4 app/controllers/checkout_controller_decorator.rb
spree_auth-0.50.3 app/controllers/checkout_controller_decorator.rb
spree_auth-0.60.3 app/controllers/checkout_controller_decorator.rb
spree_auth-0.70.1 app/controllers/checkout_controller_decorator.rb