add console redirect

pull/105/head
Alex Turchyn 2 years ago
parent 7697b94f73
commit 896b149b25

@ -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

@ -23,6 +23,9 @@
<li>
<%= link_to 'Team', settings_users_path, class: 'text-base hover:bg-base-300' %>
</li>
<li>
<%= link_to 'Console', console_redirect_index_path, class: 'text-base hover:bg-base-300' %>
</li>
</ul>
</menu-active>
<div class="mx-4 border-t border-base-300 hidden md:block">

@ -41,6 +41,7 @@ Rails.application.routes.draw do
resource :newsletter, only: %i[show update]
resources :users, only: %i[new create edit update destroy]
resources :submissions, only: %i[show destroy]
resources :console_redirect, only: %i[index]
resources :templates, only: %i[new create edit show destroy] do
resources :submissions, only: %i[new create]
end

@ -10,6 +10,11 @@ module Docuseal
TWITTER_URL = 'https://twitter.com/docusealco'
TWITTER_HANDLE = '@docusealco'
SUPPORT_EMAIL = 'support@docuseal.co'
CONSOLE_URL = if Rails.env.development?
'http://console.localhost.io:3001'
else
'https://console.docuseal.co'
end
CERTS = JSON.parse(ENV.fetch('CERTS', '{}'))

Loading…
Cancel
Save