1 class OrderController < ApplicationController
3 before_filter :require_auth, :except => [:new, :save, :thanks]
6 @order = Order.new params[:order]
7 render :template => 'order/pause'
11 @order = Order.new params[:order]
13 Promomailer.deliver_promo_order @order
14 redirect_to "/order/thanks"
16 flash[:save_errors] = @order.errors.full_messages
17 redirect_to :action => "new", :order => params[:order]
26 auth = request.env['HTTP_AUTHORIZATION'].to_s.split
28 if auth and auth[0] == "Basic"
29 login, pw = Base64.decode64(auth[1]).split(':')[0..1]
31 # TODO: fix this when we enable the online ordering again
32 if login == "admin" and pw == "secret" and false
33 @user = session[:admin_user]
38 response.headers["WWW-Authenticate"] = 'basic realm="software.opensuse.org admin login"'
39 render :text => "authentication required", :status => 401
45 @orders = Order.find :all, :conditions => "isnull(processed_by)"
49 session[:admin_user] = params[:name]
50 redirect_to :action => :admin_index
54 session[:admin_user] = nil
55 redirect_to :action => :admin_index
59 @order = Order.find params[:id]
60 @order.processed_at = Time.now
61 @order.processed_by = session[:admin_user]
65 render :partial => 'order', :object => @order