From 7dc42c24ea1c57b9cdc590520a2b6cdbf87b8ca2 Mon Sep 17 00:00:00 2001 From: Marcus Baw Date: Fri, 11 Oct 2019 12:40:11 +0100 Subject: [PATCH] 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))