Class: Spree::Api::V2::Storefront::ResetPasswordsController

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

Instance Method Summary collapse

Instance Method Details

#resource_serializerObject



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

def resource_serializer
  SpreeCmCommissioner::V2::Storefront::ResetPasswordSerializer
end

#updateObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/spree/api/v2/storefront/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/storefront/reset_passwords_controller.rb', line 20

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