diff options
author | Emelia Smith <ThisIsMissEm@users.noreply.github.com> | 2018-04-10 09:16:06 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-04-10 09:16:06 +0200 |
commit | 219a4423d8371fc89f122f3ef4874e9121b423f7 (patch) | |
tree | 89e645fec9b8effde9d496269dc0f16dd2dbd7ea /app/models | |
parent | e6e93ecd8a45cea5f0c398054c2292a5fdf944cf (diff) |
Feature: Allow staff to change user emails (#7074)
* Admin: Show unconfirmed email address on account page * Admin: Allow staff to change user email addresses * ActionLog: On change_email, log current email address and new unconfirmed email address
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 1 | ||||
-rw-r--r-- | app/models/admin/action_log.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 446144a3e..51304fc18 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -124,6 +124,7 @@ class Account < ApplicationRecord scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) } delegate :email, + :unconfirmed_email, :current_sign_in_ip, :current_sign_in_at, :confirmed?, diff --git a/app/models/admin/action_log.rb b/app/models/admin/action_log.rb index c437c8ee8..81f278e07 100644 --- a/app/models/admin/action_log.rb +++ b/app/models/admin/action_log.rb @@ -35,6 +35,11 @@ class Admin::ActionLog < ApplicationRecord self.recorded_changes = target.attributes when :update, :promote, :demote self.recorded_changes = target.previous_changes + when :change_email + self.recorded_changes = ActiveSupport::HashWithIndifferentAccess.new( + email: [target.email, nil], + unconfirmed_email: [nil, target.unconfirmed_email] + ) end end end |