Class: SessionsController

Inherits:
OfficeController show all
Defined in:
app/controllers/sessions_controller.rb

Instance Method Summary collapse

Methods inherited from OfficeController

#error

Methods included from OfficeHelper

#best_euros, #current_basket, #current_basket_or_nil, #current_clerk, #date, #euros, #has_ssl?, #markdown, #new_basket, #paginate, #shipping_method

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/sessions_controller.rb', line 8

def create
  clerk = Clerk.where(:email => params[:email]).limit(1).first
  if clerk && clerk.valid_password?(params[:password])
    session[:clerk_email] = clerk.email
    if clerk.admin
      redirect_to baskets_url , :notice => I18n.t(:signed_in)
    else
      
    end
  else
    redirect_to  , :notice => I18n.t(:sign_in_invalid)
  end
end

#sign_inObject



5
6
# File 'app/controllers/sessions_controller.rb', line 5

def 
end

#sign_outObject



22
23
24
25
# File 'app/controllers/sessions_controller.rb', line 22

def sign_out
  session[:clerk_email] = nil
  redirect_to Rails.application.routes.url_helpers.root_path , :notice => I18n.t(:signed_out)
end

#sign_upObject



27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/sessions_controller.rb', line 27

def 
  if request.get?
    @clerk = Clerk.new
  else
    @clerk = Clerk.new(params_for_clerk)
    if @clerk.save
      session[:clerk_email] = @clerk.email
      return 
    end
  end
end