Add User#email_domain method to extract domain from email address (#35159)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2025-06-25 07:22:19 +00:00
1 parent 8ba1487f30
commit f852da50f6
5 files changed
+38 -3

No files matched your search

+1
View File
@@ -163,6 +163,7 @@ class Account < ApplicationRecord
after_update_commit :trigger_update_webhooks
delegate :email,
:email_domain,
:unconfirmed_email,
:current_sign_in_at,
:created_at,
+6
View File
@@ -223,6 +223,12 @@ class User < ApplicationRecord
end
end
def email_domain
Mail::Address.new(email).domain
rescue Mail::Field::ParseError
nil
end
def update_sign_in!(new_sign_in: false)
old_current = current_sign_in_at
new_current = Time.now.utc