Class: Spree::UserSessionsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/spree/user_sessions_controller.rb', line 29

def create
  #super
  authenticate_refinery_user!

  if refinery_user_signed_in?
    respond_to do |format|
      format.html {
        flash[:success] = t(:logged_in_succesfully)
        redirect_back_or_default((current_refinery_user))
      }
      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

#destroyObject



50
51
52
53
54
# File 'app/controllers/spree/user_sessions_controller.rb', line 50

def destroy
  cookies.clear
  session.clear
  super
end

#newObject

GET /resource/sign_in



16
17
18
19
# File 'app/controllers/spree/user_sessions_controller.rb', line 16

def new
  @user = Refinery::User.new
  super
end