mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-16 04:24:23 +00:00
Merge pull request #8808 from Matt-Yorkley/login-modal
Remove all Angular code from Login/Signup process
This commit is contained in:
@@ -38,6 +38,7 @@ class ApplicationController < ActionController::Base
|
||||
include Spree::Core::ControllerHelpers::Common
|
||||
|
||||
before_action :set_cache_headers # prevent cart emptying via cache when using back button #1213
|
||||
before_action :set_after_login_url
|
||||
|
||||
include RawParams
|
||||
include EnterprisesHelper
|
||||
@@ -61,15 +62,9 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def set_checkout_redirect
|
||||
referer_path = OpenFoodNetwork::RefererParser.path(request.referer)
|
||||
if referer_path
|
||||
is_checkout_path_the_referer = [main_app.checkout_path].include?(referer_path)
|
||||
session["spree_user_return_to"] = if is_checkout_path_the_referer
|
||||
referer_path
|
||||
else
|
||||
main_app.root_path
|
||||
end
|
||||
end
|
||||
return unless URI(request.referer.to_s).path == main_app.checkout_path
|
||||
|
||||
session["spree_user_return_to"] = main_app.checkout_path
|
||||
end
|
||||
|
||||
def shopfront_session
|
||||
@@ -102,6 +97,10 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
private
|
||||
|
||||
def set_after_login_url
|
||||
store_location_for(:spree_user, params[:after_login]) if params[:after_login]
|
||||
end
|
||||
|
||||
def shopfront_redirect
|
||||
session[:shopfront_redirect]
|
||||
end
|
||||
@@ -111,7 +110,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def require_distributor_chosen
|
||||
unless @distributor = current_distributor
|
||||
unless (@distributor = current_distributor)
|
||||
redirect_to main_app.root_path
|
||||
false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user