Class: Spree::Api::V2::Storefront::AccountConfirmationsController

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

Instance Method Summary collapse

Instance Method Details

#showObject



7
8
9
10
11
12
13
14
15
# File 'app/controllers/spree/api/v2/storefront/account_confirmations_controller.rb', line 7

def show
  user = Spree.user_class.confirm_by_token(params[:id])

  if user.errors.empty?
    render json: { data: { state: user.respond_to?(:state) ? user.state : '' } }, status: :ok
  else
    render json: { error: user.errors.full_messages.to_sentence }, status: :unprocessable_entity
  end
end