adjust demo

pull/133/head
DocuSeal 2 years ago
parent a39ba5b275
commit 8e2da83f9e

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

@ -3,8 +3,7 @@
<div class="w-full text-center">
<span class="font-bold">Demo Environment</span>
<br>
Feel free to
<a href="<%= new_template_path %>" data-turbo-frame="modal" class="inline underline font-medium">create a new template</a> document form or
<a href="<%= new_template_path %>" data-turbo-frame="modal" class="inline underline font-medium">Create a new template</a> document form or
<a href="<%= start_form_url(slug: ::Template.first&.slug) %>" target="_blank" class="inline underline font-medium">submit the existing one</a> 😊
</div>
</div>

@ -8,7 +8,12 @@
<% if signed_in? %>
<div class="space-x-4 flex items-center">
<% if Docuseal.demo? %>
<%= render 'shared/github_button' %>
<a href="https://docuseal.co/sign_up" class="btn btn-neutral btn-sm btn-outline inline-flex items-center justify-center" style="height: 37px">
Sign Up
</a>
<span class="hidden sm:inline">
<%= render 'shared/github_button' %>
</span>
<% else %>
<div class="flex items-center justify-center space-x-4 mr-1">
<% if can?(:manage, EncryptedConfig) && !can?(:manage, :tenants) %>

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

Loading…
Cancel
Save