Browse Source

hide full email address for admins

closed-social-glitch-2
欧醚 1 year ago
parent
commit
c6aa9146cc
3 changed files with 7 additions and 3 deletions
  1. +5
    -0
      app/helpers/formatting_helper.rb
  2. +1
    -1
      app/views/admin/accounts/_account.html.haml
  3. +1
    -2
      app/views/admin/accounts/show.html.haml

+ 5
- 0
app/helpers/formatting_helper.rb View File

@ -56,4 +56,9 @@ module FormattingHelper
def account_field_value_format(field, with_rel_me: true)
html_aware_format(field.value, field.account.local?, with_rel_me: with_rel_me, with_domains: true, multiline: false)
end
def hide_email(email)
p1, p2 = email.split('@')
"#{p1[0]}***#{p1[-1]}@#{p2}"
end
end

+ 1
- 1
app/views/admin/accounts/_account.html.haml View File

@ -25,7 +25,7 @@
%td.accounts-table__extra
- if account.local?
- if account.user_email
= link_to account.user_email.split('@').last, admin_accounts_path(email: "%@#{account.user_email.split('@').last}"), title: account.user_email
= link_to account.user_email.split('@').last, admin_accounts_path(email: "%@#{account.user_email.split('@').last}"), title: hide_email(account.user_email)
- else
\-
%br/

+ 1
- 2
app/views/admin/accounts/show.html.haml View File

@ -102,8 +102,7 @@
%tr
%th{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= t('admin.accounts.email')
%td{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= @account.user_email
%td= table_link_to 'edit', t('admin.accounts.change_email.label'), admin_account_change_email_path(@account.id) if can?(:change_email, @account.user)
%td{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= hide_email(@account.user_email)
%tr
%td= table_link_to 'search', t('admin.accounts.search_same_email_domain'), admin_accounts_path(email: "%@#{@account.user_email.split('@').last}")

Loading…
Cancel
Save