refactor result generation

pull/133/head
DocuSeal 2 years ago
parent 761bb07ee6
commit 3dd7c47558

@ -10,7 +10,7 @@ class MfaSetupController < ApplicationController
current_user.save!
@provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Docuseal::PRODUCT_NAME)
@provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Docuseal.product_name)
end
def edit; end
@ -22,7 +22,7 @@ class MfaSetupController < ApplicationController
redirect_to settings_profile_index_path, notice: '2FA has been configured'
else
@provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Docuseal::PRODUCT_NAME)
@provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Docuseal.product_name)
@error_message = 'Code is invalid'

@ -1,8 +1,8 @@
# frozen_string_literal: true
class UserMailer < ApplicationMailer
def invitation_email(user)
@current_account = user.account
def invitation_email(user, invited_by: nil)
@current_account = invited_by&.account || user.account
@user = user
@token = @user.send(:set_reset_password_token)

@ -84,7 +84,7 @@
<div class="flex items-center h-full">
<div class="mx-auto">
<div class="max-w-xl mx-auto">
<h1 class="text-5xl font-bold text-base-content">👋 Welcome to DocuSeal</h1>
<h1 class="text-5xl font-bold text-base-content">👋 Welcome to <%= Docuseal.product_name %></h1>
</div>
<div class="max-w-lg mx-auto">
<p class="py-6 text-gray-600">Streamline document workflows, from creating customizable templates to filling and signing document forms</p>

@ -1,5 +1,5 @@
<div class="max-w-xl mx-auto px-2">
<h1 class="text-4xl font-bold text-center my-8">👋 Welcome to Docuseal</h1>
<h1 class="text-4xl font-bold text-center my-8">👋 Welcome to <%= Docuseal.product_name %></h1>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: 'space-y-6' }) do |f| %>
<div class="space-y-2">
<%= render 'devise/shared/error_messages', resource: %>

@ -2,5 +2,5 @@
---
</p>
<p>
Sent using <a href="<%= Docuseal::PRODUCT_URL %>"><%= Docuseal::PRODUCT_NAME %></a> free document signing.
Sent using <a href="<%= Docuseal::PRODUCT_URL %>"><%= Docuseal.product_name %></a> free document signing.
</p>

@ -9,5 +9,5 @@
<% else %>
Powered by
<% end %>
<a href="<%= Docuseal::PRODUCT_URL %>" class="underline"><%= Docuseal::PRODUCT_NAME %></a> - open source documents software
<a href="<%= Docuseal::PRODUCT_URL %>" class="underline"><%= Docuseal.product_name %></a> - open source documents software
</div>

@ -1,4 +1,4 @@
<a href="<%= root_path %>" class="mx-auto text-2xl md:text-3xl font-bold items-center flex space-x-3">
<%= render 'shared/logo', class: 'w-9 h-9 md:w-12 md:h-12' %>
<span><%= Docuseal::PRODUCT_NAME %></span>
<span><%= Docuseal.product_name %></span>
</a>

@ -1,5 +1,5 @@
<p>Hello <%= @user.first_name %>,</p>
<p>You have been invited to <%= @user.account.name %> DocuSeal. Please sign up using the link below:</p>
<p>You have been invited to <%= @user.account.name %> <%= Docuseal.product_name %>. Please sign up using the link below:</p>
<p><%= link_to 'Sign up', invitation_url(reset_password_token: @token) %></p>
<p>Please contact us by replying to this email if you didn't request this.</p>
<p>

@ -58,6 +58,10 @@ module Docuseal
end
end
def product_name
PRODUCT_NAME
end
def refresh_default_url_options!
@default_url_options = nil
end

@ -1,12 +1,11 @@
# frozen_string_literal: true
module GenerateCertificate
NAME = Docuseal::PRODUCT_NAME
SIZE = 2**11
module_function
def call(name = NAME)
def call(name = Docuseal.product_name)
root_cert, root_key = generate_root_ca(name)
sub_cert, sub_key = generate_sub_ca(name, root_cert, root_key)

@ -17,7 +17,7 @@ module Submissions
'Helvetica'
end
INFO_CREATOR = "#{Docuseal::PRODUCT_NAME} (#{Docuseal::PRODUCT_URL})".freeze
INFO_CREATOR = "#{Docuseal.product_name} (#{Docuseal::PRODUCT_URL})".freeze
SIGN_REASON = 'Signed with DocuSeal.co'
VERIFIED_TEXT = if Docuseal.multitenant?
'Verified by DocuSeal'
@ -62,15 +62,7 @@ module Submissions
composer.new_page
composer.column(columns: 1) do |column|
column.image(PdfIcons.logo_io, width: 40, height: 40, position: :float)
column.formatted_text([{ text: 'DocuSeal',
link: Docuseal::PRODUCT_URL }],
font_size: 20,
font: [FONT_BOLD_NAME, { variant: :bold }],
width: 100,
padding: [12, 0, 0, 8],
position: :float, position_hint: :left)
add_logo(column)
column.text('Audit Log',
font_size: 16,
@ -270,6 +262,18 @@ module Submissions
record: submission
)
end
def add_logo(column)
column.image(PdfIcons.logo_io, width: 40, height: 40, position: :float)
column.formatted_text([{ text: 'DocuSeal',
link: Docuseal::PRODUCT_URL }],
font_size: 20,
font: [FONT_BOLD_NAME, { variant: :bold }],
width: 100,
padding: [12, 0, 0, 8],
position: :float, position_hint: :left)
end
# rubocop:enable Metrics
end
end

@ -10,7 +10,7 @@ module Submissions
'Helvetica'
end
INFO_CREATOR = "#{Docuseal::PRODUCT_NAME} (#{Docuseal::PRODUCT_URL})".freeze
INFO_CREATOR = "#{Docuseal.product_name} (#{Docuseal::PRODUCT_URL})".freeze
SIGN_REASON = 'Signed by %<email>s with DocuSeal.co'
TEXT_LEFT_MARGIN = 1
@ -203,9 +203,9 @@ module Submissions
def save_signed_pdf(pdf:, submitter:, pkcs:, uuid:, name:)
io = StringIO.new
pdf.trailer.info[:Creator] = INFO_CREATOR
pdf.trailer.info[:Creator] = info_creator
pdf.sign(io, reason: format(SIGN_REASON, email: submitter.email),
pdf.sign(io, reason: sign_reason(submitter.email),
certificate: pkcs.certificate,
key: pkcs.key,
certificate_chain: pkcs.ca_certs || [])
@ -269,6 +269,14 @@ module Submissions
pdf
end
def sign_reason(email)
format(SIGN_REASON, email:)
end
def info_creator
INFO_CREATOR
end
def h
Rails.application.routes.url_helpers
end

Loading…
Cancel
Save