Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Consolidate customer creation params and support current_password (#13912)

Damian Legawiec852364a9b0df
diff --git a/spree/api/app/controllers/spree/api/v3/store/customers_controller.rb b/spree/api/app/controllers/spree/api/v3/store/customers_controller.rb
index 38638af166..11ddb45d31 100644
--- a/spree/api/app/controllers/spree/api/v3/store/customers_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/customers_controller.rb
@@ -10,7 +10,7 @@ module Spree
# POST /api/v3/store/customers
def create
- user = Spree.user_class.new(create_params)
+ user = Spree.user_class.new(permitted_params.except(:current_password))
if user.save
refresh_token = Spree::RefreshToken.create_for(user, request_env: {
@@ -67,11 +67,6 @@ module Spree
}
end
- def create_params
- params.permit(:email, :password, :password_confirmation, :first_name, :last_name,
- :phone, :accepts_email_marketing, metadata: {})
- end
-
def permitted_params
params.permit(:email, :password, :password_confirmation, :first_name, :last_name,
:accepts_email_marketing, :phone, :current_password, metadata: {})