From c9b8c719449de0be70e1a9fc492ce0e42a58ae65 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 23 Apr 2014 12:41:13 +0800 Subject: Bug 999734: User email addresses are publicly visible in profile titles --- extensions/UserProfile/Extension.pm | 7 +++++-- .../UserProfile/template/en/default/pages/user_profile.html.tmpl | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'extensions/UserProfile') diff --git a/extensions/UserProfile/Extension.pm b/extensions/UserProfile/Extension.pm index efd83591d..8671ba755 100644 --- a/extensions/UserProfile/Extension.pm +++ b/extensions/UserProfile/Extension.pm @@ -18,6 +18,7 @@ use Bugzilla::Extension::UserProfile::Util; use Bugzilla::Install::Filesystem; use Bugzilla::User; use Bugzilla::Util qw(datetime_from); +use Email::Address; use Scalar::Util qw(blessed); our $VERSION = '1'; @@ -31,10 +32,12 @@ BEGIN { *Bugzilla::User::set_last_activity_ts = \&_user_set_last_activity_ts; *Bugzilla::User::last_statistics_ts = \&_user_last_statistics_ts; *Bugzilla::User::clear_last_statistics_ts = \&_user_clear_last_statistics_ts; + *Bugzilla::User::address = \&_user_address; } -sub _user_last_activity_ts { $_[0]->{last_activity_ts} } -sub _user_last_statistics_ts { $_[0]->{last_statistics_ts} } +sub _user_last_activity_ts { $_[0]->{last_activity_ts} } +sub _user_last_statistics_ts { $_[0]->{last_statistics_ts} } +sub _user_address { Email::Address->new(undef, $_[0]->email) } sub _user_set_last_activity_ts { my ($self, $value) = @_; diff --git a/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl b/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl index fa6cc56b3..dc5696c88 100644 --- a/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl +++ b/extensions/UserProfile/template/en/default/pages/user_profile.html.tmpl @@ -8,7 +8,11 @@ [% PROCESS global/variables.none.tmpl %] -[% filtered_identity = target.identity FILTER html %] +[% IF user.id %] + [% filtered_identity = target.identity FILTER html %] +[% ELSE %] + [% filtered_identity = target.name || target.address.user FILTER html %] +[% END %] [% PROCESS global/header.html.tmpl title = "User Profile: $filtered_identity" style_urls = [ "extensions/UserProfile/web/styles/user_profile.css" ] @@ -54,7 +58,7 @@ Name - [% target.name FILTER html %] + [% target.name || target.address.user FILTER html %] [% IF target.id == user.id %] (change) [% END %] -- cgit v1.2.3-24-g4f1b