Skip to content

Commit ccabed8

Browse files
committed
fix(user_ldap): Improve case where selected config is undefined
Signed-off-by: Louis Chmn <louis@chmn.me>
1 parent 0e65434 commit ccabed8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

apps/user_ldap/src/components/SettingsTabs/ServerTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ async function guessPortAndTLS() {
148148
loadingGuessPortAndTLS.value = true
149149
const { changes } = await callWizard('guessPortAndTLS', props.configId)
150150
// Not using ldapConfigProxy to avoid triggering the save logic.
151-
ldapConfigs.value[props.configId].ldapPort = (changes!.ldap_port as string) ?? ''
151+
ldapConfigs.value[props.configId]!.ldapPort = (changes!.ldap_port as string) ?? ''
152152
} finally {
153153
loadingGuessPortAndTLS.value = false
154154
}

apps/user_ldap/src/views/Settings.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
:options="Object.keys(ldapConfigs)"
2020
:input-label="t('user_ldap', 'Select LDAP Config')">
2121
<template #option="{ label: configId }">
22-
{{ `${configId}: ${ldapConfigs[configId].ldapHost}` }}
22+
{{ `${configId}: ${ldapConfigs[configId]?.ldapHost ?? ''}` }}
2323
</template>
2424
<template #selected-option="{ label: configId }">
25-
{{ `${configId}: ${ldapConfigs[configId].ldapHost}` }}
25+
{{ `${configId}: ${ldapConfigs[configId]?.ldapHost ?? ''}` }}
2626
</template>
2727
</NcSelect>
2828
<NcButton
@@ -123,7 +123,8 @@ const selectedTab = ref('server')
123123
const clearMappingLoading = ref(false)
124124
125125
const selectedConfigHasServerInfo = computed(() => {
126-
return selectedConfig.value.ldapHost !== ''
126+
return selectedConfig.value !== undefined
127+
&& selectedConfig.value.ldapHost !== ''
127128
&& selectedConfig.value.ldapPort !== ''
128129
&& selectedConfig.value.ldapBase !== ''
129130
&& selectedConfig.value.ldapAgentName !== ''

0 commit comments

Comments
 (0)