about summary refs log tree commit diff
path: root/app/mailers
diff options
context:
space:
mode:
authorStarfall <admin@plural.cafe>2020-06-19 13:14:45 -0500
committerStarfall <admin@plural.cafe>2020-06-19 13:14:45 -0500
commit5668836f56cddf3257f38a2483c1d42cacbad3a8 (patch)
treec241a44562f79ccecaf215eb572c22d559b08dd1 /app/mailers
parent76f79dd29909d39f1d36ef48e6892223d59e29d7 (diff)
parentc7da2cc5a1821e589e7241aec21d8bb426722c2a (diff)
Merge branch 'glitch' into main
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/user_mailer.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 88a11f761..2cd58e60a 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -126,4 +126,21 @@ class UserMailer < Devise::Mailer
            reply_to: Setting.site_contact_email
     end
   end
+
+  def sign_in_token(user, remote_ip, user_agent, timestamp)
+    @resource   = user
+    @instance   = Rails.configuration.x.local_domain
+    @remote_ip  = remote_ip
+    @user_agent = user_agent
+    @detection  = Browser.new(user_agent)
+    @timestamp  = timestamp.to_time.utc
+
+    return if @resource.disabled?
+
+    I18n.with_locale(@resource.locale || I18n.default_locale) do
+      mail to: @resource.email,
+           subject: I18n.t('user_mailer.sign_in_token.subject'),
+           reply_to: Setting.site_contact_email
+    end
+  end
 end