Sha256: a106758a2510801618b8c40a5f6c27a507284bc137c7a849b0c575ade120fb75

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

UserSessionsController.class_eval do
  
  def merge 
    # lets remove the old user here
    sign_out(:user)
    # now sign in from the login form
    authenticate_user!
    
    # prep for all the shifting and do it
    user = User.find(current_user.id)
    user.user_authentications << UserAuthentication.find(params[:user_authentication])
    user.save!
    
    if current_order
      current_order.associate_user!(user)
      session[:guest_token] = nil
    end
    # trash the old anonymous that was created
    User.destroy(params[:user][:id])
    
    # tell the truth now
    flash[:alert] = "Succesfully linked your accounts"
    sign_in_and_redirect(user, :event => :authentication)
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_social-1.0.2 app/controllers/user_sessions_controller_decorator.rb
spree_social-1.0.1 app/controllers/user_sessions_controller_decorator.rb