From 7dc42c24ea1c57b9cdc590520a2b6cdbf87b8ca2 Mon Sep 17 00:00:00 2001 From: Marcus Baw Date: Fri, 11 Oct 2019 12:40:11 +0100 Subject: [PATCH 1/3] javascript based cookie setting and redirect, removed ruby cookie handling --- assets/javascripts/wizard-custom-guest.js | 7 ++++--- controllers/wizard.rb | 6 ------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/assets/javascripts/wizard-custom-guest.js b/assets/javascripts/wizard-custom-guest.js index 38a526d5..1c125403 100644 --- a/assets/javascripts/wizard-custom-guest.js +++ b/assets/javascripts/wizard-custom-guest.js @@ -1,3 +1,4 @@ -(function() { - window.location.href = "/login"; -})(); +(function () { + document.cookie = `destination_url=${window.location.href}` + window.location.href = '/login' +})() diff --git a/controllers/wizard.rb b/controllers/wizard.rb index 2d384530..e2d5656f 100644 --- a/controllers/wizard.rb +++ b/controllers/wizard.rb @@ -4,12 +4,6 @@ class CustomWizard::WizardController < ::ApplicationController helper_method :wizard_page_title helper_method :theme_ids - - before_action :handle_login_redirect, unless: :current_user - - def handle_login_redirect - cookies[:destination_url] = "/w/#{params[:wizard_id]}" - end def wizard CustomWizard::Template.new(PluginStore.get('custom_wizard', params[:wizard_id].underscore)) From aab2662f9ca5ba6ce54651c24c7f518c52dcb2d4 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 17 Oct 2019 11:16:41 +1100 Subject: [PATCH 2/3] Add path to redirect --- assets/javascripts/wizard-custom-guest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/wizard-custom-guest.js b/assets/javascripts/wizard-custom-guest.js index 1c125403..0cd43018 100644 --- a/assets/javascripts/wizard-custom-guest.js +++ b/assets/javascripts/wizard-custom-guest.js @@ -1,4 +1,4 @@ (function () { - document.cookie = `destination_url=${window.location.href}` + document.cookie = `destination_url=${window.location.href};path=/`; window.location.href = '/login' })() From 085f4b163326c3f156992b00d98ee2c55a963830 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 17 Oct 2019 11:26:21 +1100 Subject: [PATCH 3/3] Use non-e6 formatting --- assets/javascripts/wizard-custom-guest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/wizard-custom-guest.js b/assets/javascripts/wizard-custom-guest.js index 0cd43018..dc2f6430 100644 --- a/assets/javascripts/wizard-custom-guest.js +++ b/assets/javascripts/wizard-custom-guest.js @@ -1,4 +1,4 @@ (function () { - document.cookie = `destination_url=${window.location.href};path=/`; + document.cookie = 'destination_url=' + window.location.href + ';path=/'; window.location.href = '/login' })()