Commit 668deeae authored by Sean McGivern's avatar Sean McGivern 🎄

Merge branch '24921-hide-prompt-to-add-ssh-key-if-ssh-protocol-is-disabled' into 'master'

If SSH prototol is disabled don't say the user requires SSH keys

Closes #24921

See merge request !7840
parents 3ebb815a a527fab1
......@@ -512,7 +512,7 @@ class User < ActiveRecord::Base
end
def require_ssh_key?
keys.count == 0
keys.count == 0 && Gitlab::ProtocolAccess.allowed?('ssh')
end
def require_password?
......
---
title: Don't display prompt to add SSH keys if SSH protocol is disabled
merge_request: 7840
author: Andrew Smith (EspadaV8)
......@@ -575,6 +575,23 @@ describe User, models: true do
end
end
end
describe '#require_ssh_key?' do
protocol_and_expectation = {
'http' => false,
'ssh' => true,
'' => true,
}
protocol_and_expectation.each do |protocol, expected|
it "has correct require_ssh_key?" do
stub_application_setting(enabled_git_access_protocol: protocol)
user = build(:user)
expect(user.require_ssh_key?).to eq(expected)
end
end
end
end
describe '.find_by_any_email' 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