Class: Spree::Api::V2::Tenant::ResetPasswordsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v2/tenant/reset_passwords_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#render_serialized_payload, #require_tenant, #scope

Instance Method Details

#resource_serializerObject



16
17
18
# File 'app/controllers/spree/api/v2/tenant/reset_passwords_controller.rb', line 16

def resource_serializer
  Spree::V2::Tenant::ResetPasswordSerializer
end

#updateObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/spree/api/v2/tenant/reset_passwords_controller.rb', line 6

def update
  context = SpreeCmCommissioner::UserForgottenPasswordUpdater.call(update_params)

  if context.success?
    render_serialized_payload { serialize_resource(context.user) }
  else
    render_error_payload(context.message)
  end
end

#update_paramsObject



20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/spree/api/v2/tenant/reset_passwords_controller.rb', line 20

def update_params
  params.permit(
    :email,
    :phone_number,
    :country_code,
    :pin_code,
    :pin_code_token,
    :password,
    :password_confirmation
  ).merge(tenant_id: MultiTenant.current_tenant_id)
end