Remove spree user registrations controller file

This commit is contained in:
Vishal Jain
2022-10-16 12:54:01 +05:30
parent 7b96a1fb5b
commit 952b6039f9
2 changed files with 19 additions and 50 deletions

View File

@@ -1,48 +0,0 @@
# frozen_string_literal: true
require "spree/core/controller_helpers/auth"
require "spree/core/controller_helpers/common"
require "spree/core/controller_helpers/order"
module Spree
class UserRegistrationsController < Devise::RegistrationsController
helper 'spree/base'
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Common
include Spree::Core::ControllerHelpers::Order
before_action :check_permissions, only: [:edit, :update]
skip_before_action :require_no_authentication
# GET /resource/edit
def edit
super
end
# PUT /resource
def update
super
end
# DELETE /resource
def destroy
super
end
# GET /resource/cancel
# Forces the session data which is usually expired after sign
# in to be expired now. This is useful if the user wants to
# cancel oauth signing in/up in the middle of the process,
# removing all OAuth session data.
def cancel
super
end
protected
def check_permissions
authorize!(:create, resource)
end
end
end

View File

@@ -1,13 +1,24 @@
# frozen_string_literal: true
require 'open_food_network/error_logger'
require "spree/core/controller_helpers/auth"
require "spree/core/controller_helpers/common"
require "spree/core/controller_helpers/order"
class UserRegistrationsController < Spree::UserRegistrationsController
class UserRegistrationsController < Devise::RegistrationsController
I18N_SCOPE = 'devise.user_registrations.spree_user'
before_action :set_checkout_redirect, only: :create
helper 'spree/base'
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Common
include Spree::Core::ControllerHelpers::Order
include I18nHelper
before_action :check_permissions, only: [:edit, :update]
skip_before_action :require_no_authentication
before_action :set_checkout_redirect, only: :create
before_action :set_locale
# POST /resource/sign_up
@@ -31,6 +42,12 @@ class UserRegistrationsController < Spree::UserRegistrationsController
render_error(message: I18n.t('unknown_error', scope: I18N_SCOPE))
end
protected
def check_permissions
authorize!(:create, resource)
end
private
def spree_user_params