Class: Spree::UserSessionsController

Inherits:
Devise::SessionsController
  • Object
show all
Includes:
Core::ControllerHelpers, Core::CurrentOrder
Defined in:
app/controllers/spree/user_sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  authenticate_user!

  if user_signed_in?
    respond_to do |format|
      format.html {
        flash.notice = t(:logged_in_succesfully)
        redirect_back_or_default(products_path)
      }
      format.js {
        user = resource.record
        render :json => {:ship_address => user.ship_address, :bill_address => user.bill_address}.to_json
      }
    end
  else
    flash.now[:error] = t('devise.failure.invalid')
    render :new
  end
end


32
33
34
# File 'app/controllers/spree/user_sessions_controller.rb', line 32

def nav_bar
  render :partial => 'spree/shared/nav_bar'
end