mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 14:42:32 -05:00
25 lines
740 B
Ruby
25 lines
740 B
Ruby
# frozen_string_literal: true
|
|
|
|
class TemplateMailer < ApplicationMailer
|
|
def otp_verification_email(template, email:)
|
|
@current_account = template.account
|
|
@template = template
|
|
|
|
@otp_code = OtpChallenges.generate([email.downcase.squish, template.slug].join(':'), purpose: 'form_email_2fa')
|
|
|
|
assign_message_metadata('otp_verification_email', template)
|
|
|
|
from =
|
|
if Docuseal.multitenant? &&
|
|
AccountConfig.exists?(account_id: template.account_id, key: 'custom_otp_email', value: true)
|
|
put_metadata('from_user_id' => template.author_id)
|
|
|
|
template.author.friendly_name
|
|
else
|
|
default_params[:from]
|
|
end
|
|
|
|
mail(to: email, from:, subject: I18n.t('email_verification'))
|
|
end
|
|
end
|