lib/spree/auth/engine.rb in solidus_auth_devise-2.5.4 vs lib/spree/auth/engine.rb in solidus_auth_devise-2.5.5
- old
+ new
@@ -1,9 +1,11 @@
# frozen_string_literal: true
+require 'solidus_auth_devise'
require 'devise'
require 'devise-encryptable'
+require 'spree/auth/version'
module Spree
module Auth
class Engine < Rails::Engine
include SolidusSupport::EngineExtensions
@@ -46,42 +48,39 @@
end
end
def self.prepare_backend
Spree::Admin::BaseController.unauthorized_redirect = -> do
- if try_spree_current_user
+ if spree_current_user
flash[:error] = I18n.t('spree.authorization_failure')
if Spree::Auth::Engine.redirect_back_on_unauthorized?
redirect_back(fallback_location: spree.admin_unauthorized_path)
else
redirect_to spree.admin_unauthorized_path
end
else
- store_location
if Spree::Auth::Engine.redirect_back_on_unauthorized?
redirect_back(fallback_location: spree.admin_login_path)
else
redirect_to spree.admin_login_path
end
end
end
end
-
def self.prepare_frontend
Spree::BaseController.unauthorized_redirect = -> do
- if try_spree_current_user
+ if spree_current_user
flash[:error] = I18n.t('spree.authorization_failure')
if Spree::Auth::Engine.redirect_back_on_unauthorized?
redirect_back(fallback_location: spree.unauthorized_path)
else
redirect_to spree.unauthorized_path
end
else
- store_location
if Spree::Auth::Engine.redirect_back_on_unauthorized?
redirect_back(fallback_location: spree.login_path)
else
redirect_to spree.login_path