diff --git a/app/controllers/mfa_setup_controller.rb b/app/controllers/mfa_setup_controller.rb index 32cea983..ce690643 100644 --- a/app/controllers/mfa_setup_controller.rb +++ b/app/controllers/mfa_setup_controller.rb @@ -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' diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 276928ad..2ca4e2c5 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -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) diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index c844b969..c441dae3 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -84,7 +84,7 @@
-

👋 Welcome to DocuSeal

+

👋 Welcome to <%= Docuseal.product_name %>

Streamline document workflows, from creating customizable templates to filling and signing document forms

diff --git a/app/views/invitations/edit.html.erb b/app/views/invitations/edit.html.erb index 9acd372f..6357dec2 100644 --- a/app/views/invitations/edit.html.erb +++ b/app/views/invitations/edit.html.erb @@ -1,5 +1,5 @@
-

👋 Welcome to Docuseal

+

👋 Welcome to <%= Docuseal.product_name %>

<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: 'space-y-6' }) do |f| %>
<%= render 'devise/shared/error_messages', resource: %> diff --git a/app/views/shared/_email_attribution.html.erb b/app/views/shared/_email_attribution.html.erb index 76bd890d..6a253d1f 100644 --- a/app/views/shared/_email_attribution.html.erb +++ b/app/views/shared/_email_attribution.html.erb @@ -2,5 +2,5 @@ ---

- Sent using <%= Docuseal::PRODUCT_NAME %> free document signing. + Sent using <%= Docuseal.product_name %> free document signing.

diff --git a/app/views/shared/_powered_by.html.erb b/app/views/shared/_powered_by.html.erb index 47ec3f40..b9f1c77c 100644 --- a/app/views/shared/_powered_by.html.erb +++ b/app/views/shared/_powered_by.html.erb @@ -9,5 +9,5 @@ <% else %> Powered by <% end %> - <%= Docuseal::PRODUCT_NAME %> - open source documents software + <%= Docuseal.product_name %> - open source documents software
diff --git a/app/views/submit_form/_docuseal_logo.html.erb b/app/views/submit_form/_docuseal_logo.html.erb index cfd62ead..645f7fc5 100644 --- a/app/views/submit_form/_docuseal_logo.html.erb +++ b/app/views/submit_form/_docuseal_logo.html.erb @@ -1,4 +1,4 @@ <%= render 'shared/logo', class: 'w-9 h-9 md:w-12 md:h-12' %> - <%= Docuseal::PRODUCT_NAME %> + <%= Docuseal.product_name %> diff --git a/app/views/user_mailer/invitation_email.html.erb b/app/views/user_mailer/invitation_email.html.erb index 05d281f3..f9328ddd 100644 --- a/app/views/user_mailer/invitation_email.html.erb +++ b/app/views/user_mailer/invitation_email.html.erb @@ -1,5 +1,5 @@

Hello <%= @user.first_name %>,

-

You have been invited to <%= @user.account.name %> DocuSeal. Please sign up using the link below:

+

You have been invited to <%= @user.account.name %> <%= Docuseal.product_name %>. Please sign up using the link below:

<%= link_to 'Sign up', invitation_url(reset_password_token: @token) %>

Please contact us by replying to this email if you didn't request this.

diff --git a/lib/docuseal.rb b/lib/docuseal.rb index a65a896d..ce78a90d 100644 --- a/lib/docuseal.rb +++ b/lib/docuseal.rb @@ -58,6 +58,10 @@ module Docuseal end end + def product_name + PRODUCT_NAME + end + def refresh_default_url_options! @default_url_options = nil end diff --git a/lib/generate_certificate.rb b/lib/generate_certificate.rb index f3c2cb9a..045136c9 100644 --- a/lib/generate_certificate.rb +++ b/lib/generate_certificate.rb @@ -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) diff --git a/lib/submissions/generate_audit_trail.rb b/lib/submissions/generate_audit_trail.rb index 6b634886..0f8778b3 100644 --- a/lib/submissions/generate_audit_trail.rb +++ b/lib/submissions/generate_audit_trail.rb @@ -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 diff --git a/lib/submissions/generate_result_attachments.rb b/lib/submissions/generate_result_attachments.rb index c97de2f4..cbf2b2f1 100644 --- a/lib/submissions/generate_result_attachments.rb +++ b/lib/submissions/generate_result_attachments.rb @@ -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 %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