diff --git a/app/helpers/formatting_helper.rb b/app/helpers/formatting_helper.rb index 5b2ac1a2a..5e2492842 100644 --- a/app/helpers/formatting_helper.rb +++ b/app/helpers/formatting_helper.rb @@ -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 diff --git a/app/views/admin/accounts/_account.html.haml b/app/views/admin/accounts/_account.html.haml index 82dd8dfb2..4a3ac323a 100644 --- a/app/views/admin/accounts/_account.html.haml +++ b/app/views/admin/accounts/_account.html.haml @@ -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/ diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index 44867d0a2..9ebd8b861 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -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}")