<commit_before># frozen_string_literal: true

class UserMailer < Devise::Mailer
  layout 'mailer'

  helper :instance

  def confirmation_instructions(user, token, _opts = {})
    @resource = user
    @token    = token
    @instance = Rails.configuration.x.local_domain

    I18n.with_locale(@resource.locale || I18n.default_locale) do
      mail to: @resource.unconfirmed_email.blank? ? @resource.email : @resource.unconfirmed_email, subject: I18n.t('devise.mailer.confirmation_instructions.subject', instance: @instance)
    end
  end

  def reset_password_instructions(user, token, _opts = {})
    @resource = user
    @token    = token

    I18n.with_locale(@resource.locale || I18n.default_locale) do
      mail to: @resource.email, subject: I18n.t('devise.mailer.reset_password_instructions.subject')
    end
  end

  def password_change(user, _opts = {})
    @resource = user

    I18n.with_locale(@resource.locale || I18n.default_locale) do
      mail to: @resource.email, subject: I18n.t('devise.mailer.password_change.subject')
    end
  end
end
<commit_msg>Supply @instance variable in password reset instructions / password change mailer (#5215)<commit_after># frozen_string_literal: true

class UserMailer < Devise::Mailer
  layout 'mailer'

  helper :instance

  def confirmation_instructions(user, token, _opts = {})
    @resource = user
    @token    = token
    @instance = Rails.configuration.x.local_domain

    I18n.with_locale(@resource.locale || I18n.default_locale) do
      mail to: @resource.unconfirmed_email.blank? ? @resource.email : @resource.unconfirmed_email, subject: I18n.t('devise.mailer.confirmation_instructions.subject', instance: @instance)
    end
  end

  def reset_password_instructions(user, token, _opts = {})
    @resource = user
    @token    = token
    @instance = Rails.configuration.x.local_domain

    I18n.with_locale(@resource.locale || I18n.default_locale) do
      mail to: @resource.email, subject: I18n.t('devise.mailer.reset_password_instructions.subject')
    end
  end

  def password_change(user, _opts = {})
    @resource = user
    @instance = Rails.configuration.x.local_domain

    I18n.with_locale(@resource.locale || I18n.default_locale) do
      mail to: @resource.email, subject: I18n.t('devise.mailer.password_change.subject')
    end
  end
end

{'fraction_non_alphanumeric': 0.11019878997407087, 'fraction_numerical': 0.01728608470181504, 'mean_word_length': 4.065645514223195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7455788', 'n_tokens_mistral': 773, 'n_tokens_neox': 734, 'n_words': 150}