Class: Spree::Api::V2::Tenant::ChangePasswordsController
- Inherits:
-
BaseController
- Object
- ResourceController
- BaseController
- Spree::Api::V2::Tenant::ChangePasswordsController
show all
- Defined in:
- app/controllers/spree/api/v2/tenant/change_passwords_controller.rb
Instance Method Summary
collapse
#render_serialized_payload, #require_tenant, #scope
Instance Method Details
#change_password_params ⇒ Object
22
23
24
25
26
27
|
# File 'app/controllers/spree/api/v2/tenant/change_passwords_controller.rb', line 22
def change_password_params
result = params.permit(:current_password, :password, :password_confirmation)
result[:user] = spree_current_user
result.to_h
end
|
#resource_serializer ⇒ Object
18
19
20
|
# File 'app/controllers/spree/api/v2/tenant/change_passwords_controller.rb', line 18
def resource_serializer
Spree::V2::Tenant::UserSerializer
end
|
#update ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'app/controllers/spree/api/v2/tenant/change_passwords_controller.rb', line 8
def update
context = SpreeCmCommissioner::PasswordChanger.call(change_password_params)
if context.success?
render_serialized_payload { serialize_resource(context.user) }
else
render_error_payload(context.message)
end
end
|