Class: Spree::UnauthorizedRedirectHandler

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/unauthorized_redirect_handler.rb

Overview

This service object is responsible for handling unauthorized redirects

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ UnauthorizedRedirectHandler

Returns a new instance of UnauthorizedRedirectHandler.

Parameters:



8
9
10
# File 'app/models/spree/unauthorized_redirect_handler.rb', line 8

def initialize(controller)
  @controller = controller
end

Instance Method Details

#callObject

This method is responsible for handling unauthorized redirects



13
14
15
16
# File 'app/models/spree/unauthorized_redirect_handler.rb', line 13

def call
  flash[:error] = I18n.t('spree.authorization_failure')
  redirect_back(fallback_location: "/unauthorized")
end