Sha256: b01c83f6735d8737d9279a8bfdf887890a2ca8ffb00779338c098828e941cddf

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

class Spree::UserRegistrationsController < Devise::RegistrationsController
  helper 'spree/base', 'spree/store'

  include Spree::Core::ControllerHelpers::Auth
  include Spree::Core::ControllerHelpers::Common
  include Spree::Core::ControllerHelpers::Order
  include Spree::Core::ControllerHelpers::Store

  before_action :check_permissions, only: [:edit, :update]
  skip_before_action :require_no_authentication

  def create
    build_resource(spree_user_params)
    if resource.save
      set_flash_message(:notice, :signed_up)
      sign_in(:spree_user, resource)
      session[:spree_user_signup] = true
      respond_with resource, location: after_sign_up_path_for(resource)
    else
      clean_up_passwords(resource)
      respond_with(resource) do |format|
        format.html { render :new }
      end
    end
  end

  protected

  def translation_scope
    'devise.user_registrations'
  end

  def check_permissions
    authorize!(:create, resource)
  end

  private

  def spree_user_params
    params.require(:spree_user).permit(Spree::PermittedAttributes.user_attributes | [:email])
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
solidus_auth_devise-2.5.9 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.8 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.7 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.6 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.5 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.4 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.3 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.2 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.1 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.5.0 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.4.0 lib/controllers/frontend/spree/user_registrations_controller.rb
solidus_auth_devise-2.3.0 lib/controllers/frontend/spree/user_registrations_controller.rb