From c1d809f989e31f4a17b3b8b6a8f2624257895ec8 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Wed, 7 Oct 2026 08:40:46 +0300 Subject: [PATCH] update demo --- app/controllers/application_controller.rb | 7 +++++- app/views/accounts/show.html.erb | 2 +- app/views/shared/_demo_alert.html.erb | 2 +- config/locales/i18n.yml | 14 ++++++------ lib/accounts.rb | 28 ----------------------- 5 files changed, 15 insertions(+), 38 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c4955b3bb..33257be89 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -118,7 +118,12 @@ class ApplicationController < ActionController::Base end def sign_in_for_demo - sign_in(User.active.order('random()').take) unless signed_in? + return if signed_in? + + account = Account.create!(name: "Demo #{SecureRandom.hex(3)}") + + sign_in(account.users.create!(first_name: 'Demo', last_name: 'User', + email: "#{SecureRandom.hex}@docuseal.com", password: SecureRandom.hex)) end def current_account diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index 96653e662..cff43da56 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -196,7 +196,7 @@ <% end %> <% end %> <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::DOWNLOAD_LINKS_EXPIRE_KEY) %> - <% if can?(:manage, account_config) %> + <% if !Docuseal.demo? && can?(:manage, account_config) %> <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
diff --git a/app/views/shared/_demo_alert.html.erb b/app/views/shared/_demo_alert.html.erb index 45e36accd..7c2600847 100644 --- a/app/views/shared/_demo_alert.html.erb +++ b/app/views/shared/_demo_alert.html.erb @@ -3,7 +3,7 @@
<%= t('demo_environment') %>
- <%= t('create_a_new_template_document_form_or_submit_the_existing_one_html', new_template_link: new_template_path, start_form_link: start_form_url(slug: ::Template.first&.slug)) %> 😊 + <%= t('create_a_new_template_document_form_html', new_template_link: new_template_path) %>
diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index bb9f5eb65..8b6f193f2 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -715,7 +715,7 @@ en: &en declined_on_time: 'Declined on %{time}' expire_on_time: 'Expire on %{time}' sign_in_person: Sign In-person - create_a_new_template_document_form_or_submit_the_existing_one_html: Create a new template document form or submit the existing one + create_a_new_template_document_form_html: Create a new template document form send_email_copy_with_completed_documents_to_a_specified_bcc_address: Send email copy with completed documents to a specified BCC address. re_send_email: Re-send Email re_send_emails: Re-send Emails @@ -1873,7 +1873,7 @@ es: &es declined_on_time: 'Rechazado el %{time}' expire_on_time: 'Expira el %{time}' sign_in_person: Firma en persona - create_a_new_template_document_form_or_submit_the_existing_one_html: Crear una nueva plantilla de documento o enviar el existente + create_a_new_template_document_form_html: Crear una nueva plantilla de documento send_email_copy_with_completed_documents_to_a_specified_bcc_address: Enviar una copia del correo electrónico con los documentos completados a una dirección BCC especificada. re_send_email: Reenviar email re_send_emails: Reenviar emails @@ -3034,7 +3034,7 @@ it: &it declined_on_time: 'Rifiutato il %{time}' expire_on_time: 'Scade il %{time}' sign_in_person: Firma di persona - create_a_new_template_document_form_or_submit_the_existing_one_html: Crea un nuovo modello di documento o invia quello esistente + create_a_new_template_document_form_html: Crea un nuovo modello di documento send_email_copy_with_completed_documents_to_a_specified_bcc_address: Invia una copia dell'email con i documenti completati a un indirizzo BCC specificato. re_send_email: Reinvia email re_send_emails: Reinvia le email @@ -4181,7 +4181,7 @@ fr: &fr declined_on_time: Refusé le %{time} expire_on_time: Expire le %{time} sign_in_person: Signer en personne - create_a_new_template_document_form_or_submit_the_existing_one_html: Créez un nouveau modèle de document ou soumettez l’existant + create_a_new_template_document_form_html: Créez un nouveau modèle de document send_email_copy_with_completed_documents_to_a_specified_bcc_address: Envoyer une copie e‑mail avec les documents complétés à une adresse Cci spécifiée. re_send_email: Renvoyer l’e‑mail re_send_emails: Renvoyer e‑mails @@ -5338,7 +5338,7 @@ pt: &pt declined_on_time: 'Recusado em %{time}' expire_on_time: 'Expira em %{time}' sign_in_person: Assinar pessoalmente - create_a_new_template_document_form_or_submit_the_existing_one_html: 'Criar um novo modelo de documento ou submeter o existente' + create_a_new_template_document_form_html: 'Criar um novo modelo de documento' send_email_copy_with_completed_documents_to_a_specified_bcc_address: Envie uma cópia do e-mail com documentos concluídos para um endereço BCC especificado. re_send_email: Reenviar e-mail re_send_emails: Reenviar e-mails @@ -6498,7 +6498,7 @@ de: &de declined_on_time: 'Abgelehnt am %{time}' expire_on_time: 'Läuft ab am %{time}' sign_in_person: Vor Ort unterschreiben - create_a_new_template_document_form_or_submit_the_existing_one_html: Neue Vorlage erstellen oder bestehende einreichen + create_a_new_template_document_form_html: Neue Vorlage erstellen send_email_copy_with_completed_documents_to_a_specified_bcc_address: Senden Sie eine E-Mail-Kopie mit abgeschlossenen Dokumenten an eine angegebene BCC-Adresse. re_send_email: E-Mail erneut senden re_send_emails: E-Mails senden @@ -8186,7 +8186,7 @@ nl: &nl declined_on_time: Geweigerd op %{time} expire_on_time: Verloopt op %{time} sign_in_person: In persoon ondertekenen - create_a_new_template_document_form_or_submit_the_existing_one_html: Maak een nieuw sjabloon voor een documentformulier of dien het bestaande in + create_a_new_template_document_form_html: Maak een nieuw sjabloon voor een documentformulier send_email_copy_with_completed_documents_to_a_specified_bcc_address: Stuur een e-mailkopie met voltooide documenten naar een opgegeven BCC-adres. re_send_email: E-mail opnieuw verzenden re_send_emails: E-mails verzenden diff --git a/lib/accounts.rb b/lib/accounts.rb index 123747ebd..5ac13f0c0 100644 --- a/lib/accounts.rb +++ b/lib/accounts.rb @@ -5,34 +5,6 @@ module Accounts module_function - def create_duplicate(account) - new_account = account.dup - - 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.com" - - account.templates.each do |template| - new_template = template.dup - - new_template.account = new_account - new_template.slug = SecureRandom.base58(14) - - new_template.archived_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 - def users_count(account) rel = User.where(account_id: account.id).or( User.where(account_id: account.account_linked_accounts