diff --git a/assets/javascripts/wizard-custom-guest.js b/assets/javascripts/wizard-custom-guest.js new file mode 100644 index 00000000..38a526d5 --- /dev/null +++ b/assets/javascripts/wizard-custom-guest.js @@ -0,0 +1,3 @@ +(function() { + window.location.href = "/login"; +})(); diff --git a/controllers/wizard.rb b/controllers/wizard.rb index e2d5656f..2d384530 100644 --- a/controllers/wizard.rb +++ b/controllers/wizard.rb @@ -4,6 +4,12 @@ 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)) diff --git a/views/layouts/wizard.html.erb b/views/layouts/wizard.html.erb index 251d13ed..db15672b 100644 --- a/views/layouts/wizard.html.erb +++ b/views/layouts/wizard.html.erb @@ -40,8 +40,12 @@ <%= raw theme_lookup("body_tag") %> <%- end %> - <%= preload_script 'wizard-custom-start' %> - <%= preload_script 'wizard-raw-templates' %> + <%- if current_user %> + <%= preload_script 'wizard-custom-start' %> + <%= preload_script 'wizard-raw-templates' %> + <%- else %> + <%= preload_script 'wizard-custom-guest' %> + <%- end %>