feat(ldap): Adding support for LDAP authentication (#554)

This commit is contained in:
WolverinDEV
2024-08-24 16:15:33 +02:00
committed by GitHub
parent 4924f76394
commit 4186a768b3
17 changed files with 573 additions and 128 deletions

View File

@@ -157,6 +157,7 @@ const Account = () => {
<Stack>
<TextInput
label={t("account.card.info.username")}
disabled={user?.isLdap}
{...accountForm.getInputProps("username")}
/>
<TextInput
@@ -171,45 +172,47 @@ const Account = () => {
</Stack>
</form>
</Paper>
<Paper withBorder p="xl" mt="lg">
<Title order={5} mb="xs">
<FormattedMessage id="account.card.password.title" />
</Title>
<form
onSubmit={passwordForm.onSubmit((values) =>
authService
.updatePassword(values.oldPassword, values.password)
.then(async () => {
refreshUser();
toast.success(t("account.notify.password.success"));
passwordForm.reset();
})
.catch(toast.axiosError),
)}
>
<Stack>
{user?.hasPassword ? (
<PasswordInput
label={t("account.card.password.old")}
{...passwordForm.getInputProps("oldPassword")}
/>
) : (
<Text size="sm" color="dimmed">
<FormattedMessage id="account.card.password.noPasswordSet" />
</Text>
{user?.isLdap ? null : (
<Paper withBorder p="xl" mt="lg">
<Title order={5} mb="xs">
<FormattedMessage id="account.card.password.title" />
</Title>
<form
onSubmit={passwordForm.onSubmit((values) =>
authService
.updatePassword(values.oldPassword, values.password)
.then(async () => {
refreshUser();
toast.success(t("account.notify.password.success"));
passwordForm.reset();
})
.catch(toast.axiosError),
)}
<PasswordInput
label={t("account.card.password.new")}
{...passwordForm.getInputProps("password")}
/>
<Group position="right">
<Button type="submit">
<FormattedMessage id="common.button.save" />
</Button>
</Group>
</Stack>
</form>
</Paper>
>
<Stack>
{user?.hasPassword ? (
<PasswordInput
label={t("account.card.password.old")}
{...passwordForm.getInputProps("oldPassword")}
/>
) : (
<Text size="sm" color="dimmed">
<FormattedMessage id="account.card.password.noPasswordSet" />
</Text>
)}
<PasswordInput
label={t("account.card.password.new")}
{...passwordForm.getInputProps("password")}
/>
<Group position="right">
<Button type="submit">
<FormattedMessage id="common.button.save" />
</Button>
</Group>
</Stack>
</form>
</Paper>
)}
{oauth.length > 0 && (
<Paper withBorder p="xl" mt="lg">
<Title order={5} mb="xs">