BigW Consortium Gitlab

Commit 7a139c16 by Bob Van Landuyt

Add username to terms message in git and API calls

This will make it clearer to users which account is being used to make the API/git call. So they know which account needs to be used to accept the terms. Closes #46649
parent c52db71e
---
title: Add username to terms message in git and API calls
merge_request: 19126
author:
type: changed
......@@ -8,12 +8,12 @@ module Gitlab
def rejection_message
case rejection_type
when :internal
'This action cannot be performed by internal users'
"This action cannot be performed by internal users"
when :terms_not_accepted
'You must accept the Terms of Service in order to perform this action. '\
'Please access GitLab from a web browser to accept these terms.'
"You (#{@user.to_reference}) must accept the Terms of Service in order to perform this action. "\
"Please access GitLab from a web browser to accept these terms."
else
'Your account has been blocked.'
"Your account has been blocked."
end
end
......
......@@ -22,7 +22,8 @@ describe Gitlab::Auth::UserAccessDeniedReason do
enforce_terms
end
it { is_expected.to match /You must accept the Terms of Service/ }
it { is_expected.to match /must accept the Terms of Service/ }
it { is_expected.to include(user.username) }
end
context 'when the user is internal' do
......
......@@ -1055,7 +1055,7 @@ describe Gitlab::GitAccess do
it 'blocks access when the user did not accept terms', :aggregate_failures do
actions.each do |action|
expect { action.call }.to raise_unauthorized(/You must accept the Terms of Service in order to perform this action/)
expect { action.call }.to raise_unauthorized(/must accept the Terms of Service in order to perform this action/)
end
end
......
......@@ -171,7 +171,7 @@ describe API::Helpers do
end
it 'returns a 403 when a user has not accepted the terms' do
expect { current_user }.to raise_error /You must accept the Terms of Service/
expect { current_user }.to raise_error /must accept the Terms of Service/
end
it 'sets the current user when the user accepted the terms' 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