Adds LDAP auth support

This commit is contained in:
Jamie Curnow
2024-11-02 21:36:07 +10:00
parent 8434a2d1fa
commit a277a5d167
54 changed files with 765 additions and 306 deletions

View File

@@ -1,9 +1,9 @@
import { useEffect, useRef } from "react";
import {
Box,
Center,
Flex,
Box,
FormControl,
FormErrorMessage,
FormLabel,
@@ -12,7 +12,7 @@ import {
useColorModeValue,
useToast,
} from "@chakra-ui/react";
import { Formik, Form, Field } from "formik";
import { Field, Form, Formik } from "formik";
import { LocalePicker, PrettyButton, ThemeSwitcher } from "src/components";
import { useAuthState } from "src/context";
@@ -40,7 +40,7 @@ function Login() {
};
try {
await login(values.email, values.password);
await login("local", values.email, values.password);
} catch (err) {
if (err instanceof Error) {
showErr(err.message);

View File

@@ -7,14 +7,14 @@ import {
FormControl,
FormErrorMessage,
FormLabel,
Stack,
Heading,
Input,
Stack,
useColorModeValue,
useToast,
} from "@chakra-ui/react";
import { useQueryClient } from "@tanstack/react-query";
import { Formik, Form, Field } from "formik";
import { Field, Form, Formik } from "formik";
import { createUser } from "src/api/npm";
// import logo from "src/assets/logo-256.png";
@@ -42,7 +42,7 @@ function Setup() {
...{
isDisabled: false,
auth: {
type: "password",
type: "local",
secret: values.password,
},
capabilities: ["full-admin"],
@@ -65,7 +65,7 @@ function Setup() {
const response = await createUser(payload);
if (response && typeof response.id !== "undefined" && response.id) {
try {
await login(response.email, password);
await login("local", response.email, password);
// Trigger a Health change
await queryClient.refetchQueries({ queryKey: ["health"] });
// window.location.reload();