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
This commit is contained in:
parent
c52db71e36
commit
7a139c1602
5 changed files with 13 additions and 7 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue