feat(auth): show login form when only ldap is enabled

This commit is contained in:
kolaente 2025-01-28 10:31:34 +01:00 committed by konrad
parent f898bdaf2d
commit 9dc351f5a4
3 changed files with 18 additions and 6 deletions

View File

@ -32,6 +32,9 @@ export interface ConfigState {
local: {
enabled: boolean,
},
ldap: {
enabled: boolean,
},
openidConnect: {
enabled: boolean,
redirectUrl: string,
@ -66,6 +69,9 @@ export const useConfigStore = defineStore('config', () => {
local: {
enabled: true,
},
ldap: {
enabled: false,
},
openidConnect: {
enabled: false,
redirectUrl: '',

View File

@ -16,7 +16,7 @@
{{ errorMessage }}
</Message>
<form
v-if="localAuthEnabled"
v-if="localAuthEnabled || ldapAuthEnabled"
id="loginform"
@submit.prevent="submit"
>
@ -55,6 +55,7 @@
for="password"
>{{ $t('user.auth.password') }}</label>
<RouterLink
v-if="localAuthEnabled"
:to="{ name: 'user.password-reset.request' }"
class="reset-password-link"
tabindex="6"
@ -170,6 +171,7 @@ const {redirectIfSaved} = useRedirectToLastVisited()
const registrationEnabled = computed(() => configStore.registrationEnabled)
const localAuthEnabled = computed(() => configStore.auth.local.enabled)
const ldapAuthEnabled = computed(() => configStore.auth.ldap.enabled)
const openidConnect = computed(() => configStore.auth.openidConnect)
const hasOpenIdProviders = computed(() => openidConnect.value.enabled && openidConnect.value.providers?.length > 0)

View File

@ -55,11 +55,12 @@ type vikunjaInfos struct {
}
type authInfo struct {
Local localAuthInfo `json:"local"`
OpenIDConnect openIDAuthInfo `json:"openid_connect"`
Local enabledAuthInfo `json:"local"`
Ldap enabledAuthInfo `json:"ldap"`
OpenIDConnect openIDAuthInfo `json:"openid_connect"`
}
type localAuthInfo struct {
type enabledAuthInfo struct {
Enabled bool `json:"enabled"`
}
@ -87,7 +88,7 @@ func Info(c echo.Context) error {
Motd: config.ServiceMotd.GetString(),
LinkSharingEnabled: config.ServiceEnableLinkSharing.GetBool(),
MaxFileSize: config.FilesMaxSize.GetString(),
RegistrationEnabled: config.ServiceEnableRegistration.GetBool(),
RegistrationEnabled: config.AuthLocalEnabled.GetBool() && config.ServiceEnableRegistration.GetBool(),
TaskAttachmentsEnabled: config.ServiceEnableTaskAttachments.GetBool(),
TotpEnabled: config.ServiceEnableTotp.GetBool(),
CaldavEnabled: config.ServiceEnableCaldav.GetBool(),
@ -106,9 +107,12 @@ func Info(c echo.Context) error {
PrivacyPolicyURL: config.LegalPrivacyURL.GetString(),
},
AuthInfo: authInfo{
Local: localAuthInfo{
Local: enabledAuthInfo{
Enabled: config.AuthLocalEnabled.GetBool(),
},
Ldap: enabledAuthInfo{
Enabled: config.AuthLdapEnabled.GetBool(),
},
OpenIDConnect: openIDAuthInfo{
Enabled: config.AuthOpenIDEnabled.GetBool(),
},