From 8e2da83f9e697161ba0ba2692fa4b2adc176ed8c Mon Sep 17 00:00:00 2001 From: DocuSeal Date: Sat, 14 Oct 2023 21:19:21 +0300 Subject: [PATCH] adjust demo --- app/controllers/application_controller.rb | 2 +- app/views/shared/_demo_alert.html.erb | 3 +-- app/views/shared/_navbar.html.erb | 7 ++++++- lib/accounts.rb | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e860fe4f..38b541aa 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -33,7 +33,7 @@ class ApplicationController < ActionController::Base private def sign_in_for_demo - sign_in(User.order('random()').take) unless signed_in? + sign_in(User.active.order('random()').take) unless signed_in? end def current_account diff --git a/app/views/shared/_demo_alert.html.erb b/app/views/shared/_demo_alert.html.erb index 9b1c17b4..eb40127c 100644 --- a/app/views/shared/_demo_alert.html.erb +++ b/app/views/shared/_demo_alert.html.erb @@ -3,8 +3,7 @@
Demo Environment
- Feel free to - create a new template document form or + Create a new template document form or submit the existing one 😊
diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb index 889c9bbc..74db7f2d 100644 --- a/app/views/shared/_navbar.html.erb +++ b/app/views/shared/_navbar.html.erb @@ -8,7 +8,12 @@ <% if signed_in? %>
<% if Docuseal.demo? %> - <%= render 'shared/github_button' %> + + Sign Up + + <% else %>
<% if can?(:manage, EncryptedConfig) && !can?(:manage, :tenants) %> diff --git a/lib/accounts.rb b/lib/accounts.rb index 504fb005..1a73c459 100644 --- a/lib/accounts.rb +++ b/lib/accounts.rb @@ -8,6 +8,7 @@ module Accounts new_user = account.users.first.dup + new_user.uuid = SecureRandom.uuid new_user.account = new_account new_user.encrypted_password = SecureRandom.hex new_user.email = "#{SecureRandom.hex}@docuseal.co" @@ -18,12 +19,14 @@ module Accounts new_template.account = new_account new_template.slug = SecureRandom.base58(14) + new_template.deleted_at = nil new_template.save! Templates::CloneAttachments.call(template: new_template, original_template: template) end new_user.save!(validate: false) + new_account.templates.update_all(folder_id: new_account.default_template_folder.id) new_account end