Commit 11994821 authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Merge branch 'fix-unverified-email-badge' into 'master'

Prevent unauthorized display of GitLab employee badge

Closes #212618

See merge request gitlab-org/gitlab!28397
parents e587c386 072f29fd
...@@ -1689,7 +1689,7 @@ class User < ApplicationRecord ...@@ -1689,7 +1689,7 @@ class User < ApplicationRecord
def gitlab_employee? def gitlab_employee?
strong_memoize(:gitlab_employee) do strong_memoize(:gitlab_employee) do
if Gitlab.com? if Gitlab.com?
Mail::Address.new(email).domain == "gitlab.com" Mail::Address.new(email).domain == "gitlab.com" && confirmed?
else else
false false
end end
......
...@@ -4400,6 +4400,12 @@ describe User, :do_not_mock_admin_mode do ...@@ -4400,6 +4400,12 @@ describe User, :do_not_mock_admin_mode do
it { is_expected.to be expected_result } it { is_expected.to be expected_result }
end end
context 'when email is of Gitlab and is not confirmed' do
let(:user) { build(:user, email: 'test@gitlab.com', confirmed_at: nil) }
it { is_expected.to be false }
end
end end
describe '#current_highest_access_level' do describe '#current_highest_access_level' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment