Merge pull request #2304 from rancher/auth-tls-port-fix

LDAP Auth: Change the port number when the user changes the TLS setting
This commit is contained in:
Vincent Fiduccia 2021-02-09 09:20:03 -08:00 committed by GitHub
commit 9e5c56c99d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -6,6 +6,9 @@ import UnitInput from '@/components/form/UnitInput';
import Banner from '@/components/Banner';
import FileSelector from '@/components/form/FileSelector';
const DEFAULT_NON_TLS_PORT = 389;
const DEFAULT_TLS_PORT = 636;
export default {
components: {
RadioGroup,
@ -59,6 +62,17 @@ export default {
if (neu) {
this.model.starttls = false;
}
const expectedCurrentDefault = neu ? DEFAULT_NON_TLS_PORT : DEFAULT_TLS_PORT;
const newDefault = neu ? DEFAULT_TLS_PORT : DEFAULT_NON_TLS_PORT;
// Note: The defualt port value is a number
// If the user edits this value, the type will be a string
// Thus, we will only change the value when the user toggles the TLS flag if they have
// NOT edited the port value in any way
if (this.model.port === expectedCurrentDefault) {
this.value.port = newDefault;
}
}
}