Commit 072f29fd authored by Aishwarya Subramanian's avatar Aishwarya Subramanian

Return false for unconfirmed email

parent dbdac50a
...@@ -1695,7 +1695,7 @@ class User < ApplicationRecord ...@@ -1695,7 +1695,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
......
...@@ -4420,6 +4420,12 @@ describe User, :do_not_mock_admin_mode do ...@@ -4420,6 +4420,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