Merge branch 'stable-2.16'
* stable-2.16: Fix hiding http credentials if using a different auth type. Change-Id: I98d9c3a96b0fbbc8128ddf77220fc04cf357c592
This commit is contained in:
@@ -384,10 +384,12 @@ limitations under the License.
|
|||||||
disabled="[[!_computeAddEmailButtonEnabled(_newEmail, _addingEmail)]]"
|
disabled="[[!_computeAddEmailButtonEnabled(_newEmail, _addingEmail)]]"
|
||||||
on-tap="_handleAddEmailButton">Send verification</gr-button>
|
on-tap="_handleAddEmailButton">Send verification</gr-button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<div hidden$="[[!_showHttpAuth(_serverConfig)]]">
|
||||||
<h2 id="HTTPCredentials">HTTP Credentials</h2>
|
<h2 id="HTTPCredentials">HTTP Credentials</h2>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<gr-http-password id="httpPass"></gr-http-password>
|
<gr-http-password id="httpPass"></gr-http-password>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
</div>
|
||||||
<div hidden$="[[!_serverConfig.sshd]]">
|
<div hidden$="[[!_serverConfig.sshd]]">
|
||||||
<h2
|
<h2
|
||||||
id="SSHKeys"
|
id="SSHKeys"
|
||||||
|
|||||||
@@ -40,6 +40,11 @@
|
|||||||
|
|
||||||
const RELOAD_MESSAGE = 'Reloading...';
|
const RELOAD_MESSAGE = 'Reloading...';
|
||||||
|
|
||||||
|
const HTTP_AUTH = [
|
||||||
|
'HTTP',
|
||||||
|
'HTTP_LDAP',
|
||||||
|
];
|
||||||
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'gr-settings-view',
|
is: 'gr-settings-view',
|
||||||
|
|
||||||
@@ -413,5 +418,15 @@
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 1);
|
}, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_showHttpAuth(config) {
|
||||||
|
if (config && config.auth &&
|
||||||
|
config.auth.git_basic_auth_policy) {
|
||||||
|
return HTTP_AUTH.includes(
|
||||||
|
config.auth.git_basic_auth_policy.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -407,6 +407,46 @@ limitations under the License.
|
|||||||
assert.isTrue(overlayOpen.called);
|
assert.isTrue(overlayOpen.called);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('_showHttpAuth', () => {
|
||||||
|
let serverConfig;
|
||||||
|
|
||||||
|
serverConfig = {
|
||||||
|
auth: {
|
||||||
|
git_basic_auth_policy: 'HTTP',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.isTrue(element._showHttpAuth(serverConfig));
|
||||||
|
|
||||||
|
serverConfig = {
|
||||||
|
auth: {
|
||||||
|
git_basic_auth_policy: 'HTTP_LDAP',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.isTrue(element._showHttpAuth(serverConfig));
|
||||||
|
|
||||||
|
serverConfig = {
|
||||||
|
auth: {
|
||||||
|
git_basic_auth_policy: 'LDAP',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.isFalse(element._showHttpAuth(serverConfig));
|
||||||
|
|
||||||
|
serverConfig = {
|
||||||
|
auth: {
|
||||||
|
git_basic_auth_policy: 'OAUTH',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.isFalse(element._showHttpAuth(serverConfig));
|
||||||
|
|
||||||
|
serverConfig = {};
|
||||||
|
|
||||||
|
assert.isFalse(element._showHttpAuth(serverConfig));
|
||||||
|
});
|
||||||
|
|
||||||
suite('_getFilterDocsLink', () => {
|
suite('_getFilterDocsLink', () => {
|
||||||
test('with http: docs base URL', () => {
|
test('with http: docs base URL', () => {
|
||||||
const base = 'http://example.com/';
|
const base = 'http://example.com/';
|
||||||
|
|||||||
Reference in New Issue
Block a user