Class: Spree::UsersController

Inherits:
StoreController
  • Object
show all
Defined in:
app/controllers/spree/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/spree/users_controller.rb', line 11

def create
  @user = Refinery::User.new(params[:user])
  if @user.save

    if current_order
      session[:guest_token] = nil
    end

    redirect_back_or_default(root_url)
  else
    render :new
  end
end

#showObject



7
8
9
# File 'app/controllers/spree/users_controller.rb', line 7

def show
  @orders = @user.orders.complete
end

#updateObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/spree/users_controller.rb', line 25

def update
  if @user.update_attributes(params[:user])
    if params[:user][:password].present?
      # this logic needed b/c devise wants to log us out after password changes
      user = Refinery::User.reset_password_by_token(params[:user])
      (@user, :event => :authentication, :bypass => !Spree::Auth::Config[:signout_after_password_change])
    end
    redirect_to spree., :notice => t(:account_updated)
  else
    render :edit
  end
end