Sha256: 44aca05b185704a726cacc4c16f19d12d573d717b2db8897a40a444531f29847
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
class Spree::UsersController < Spree::BaseController ssl_required prepend_before_filter :load_object, :only => [:show, :edit, :update] prepend_before_filter :authorize_actions, :only => :new def show @orders = @user.orders.complete end def create @user = Spree::User.new(params[:user]) if @user.save if current_order current_order.associate_user!(@user) session[:guest_token] = nil end redirect_back_or_default(root_url) else render :new end end 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 = Spree::User.reset_password_by_token(params[:user]) sign_in(@user, :event => :authentication, :bypass => !Spree::Auth::Config[:signout_after_password_change]) end redirect_to spree.account_url, :notice => t(:account_updated) else render :edit end end private def load_object @user ||= current_user authorize! params[:action].to_sym, @user end def authorize_actions authorize! params[:action].to_sym, Spree::User end def accurate_title t(:my_account) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spree_auth-1.1.0 | app/controllers/spree/users_controller.rb |
spree_auth-1.1.0.rc2 | app/controllers/spree/users_controller.rb |
spree_auth-1.1.0.rc1 | app/controllers/spree/users_controller.rb |