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

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

Instance Method Summary collapse

Instance Method Details

#resource_serializerObject



20
21
22
# File 'app/controllers/spree/api/v2/storefront/reset_passwords_controller.rb', line 20

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

#updateObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/spree/api/v2/storefront/reset_passwords_controller.rb', line 10

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



24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/spree/api/v2/storefront/reset_passwords_controller.rb', line 24

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