From 896b149b253205f22d20e0bb26fd0328cb91dad2 Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Sat, 5 Aug 2023 11:02:00 +0300 Subject: [PATCH] add console redirect --- app/controllers/console_redirect_controller.rb | 11 +++++++++++ app/views/shared/_settings_nav.html.erb | 3 +++ config/routes.rb | 1 + lib/docuseal.rb | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 app/controllers/console_redirect_controller.rb diff --git a/app/controllers/console_redirect_controller.rb b/app/controllers/console_redirect_controller.rb new file mode 100644 index 00000000..2424c9da --- /dev/null +++ b/app/controllers/console_redirect_controller.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class ConsoleRedirectController < ApplicationController + def index + auth = JsonWebToken.encode(uuid: current_user.uuid, + action: :sign_in, + exp: 1.minute.from_now.to_i) + + redirect_to("#{Docuseal::CONSOLE_URL}?#{{ auth: }.to_query}", allow_other_host: true) + end +end diff --git a/app/views/shared/_settings_nav.html.erb b/app/views/shared/_settings_nav.html.erb index 7b890467..20f48c25 100644 --- a/app/views/shared/_settings_nav.html.erb +++ b/app/views/shared/_settings_nav.html.erb @@ -23,6 +23,9 @@
  • <%= link_to 'Team', settings_users_path, class: 'text-base hover:bg-base-300' %>
  • +
  • + <%= link_to 'Console', console_redirect_index_path, class: 'text-base hover:bg-base-300' %> +