Class: UserSessionsController

Inherits:
Spree::BaseController show all
Defined in:
app/controllers/user_sessions_controller.rb

Instance Method Summary collapse

Methods inherited from Spree::BaseController

#access_forbidden, #find_order, #initialize_extension_partials

Methods included from EasyRoleRequirementSystem

included

Methods included from EasyRoleRequirementSystem::InstanceMethods

#included

Methods included from RoleRequirementSystem

included

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/user_sessions_controller.rb', line 10

def create
  @user_session = UserSession.new(params[:user_session])
  success = @user_session.save 
  respond_to do |format|
    format.html {                                
      if success 
        flash[:notice] = t("logged_in_succesfully")
        redirect_back_or_default products_path
      else
        flash.now[:error] = t("login_failed")
        render :new
      end
    }
    format.js {
      render :js => success.to_json
    }
  end    
end

#destroyObject



29
30
31
32
33
# File 'app/controllers/user_sessions_controller.rb', line 29

def destroy
  current_user_session.destroy
  flash[:notice] = t("logged_out")
  redirect_to products_path
end

#login_barObject



35
36
37
# File 'app/controllers/user_sessions_controller.rb', line 35

def 
  render :partial => "shared/login_bar"
end

#newObject



6
7
8
# File 'app/controllers/user_sessions_controller.rb', line 6

def new
  @user_session = UserSession.new
end