CI stack for Authentik with ldap

This commit is contained in:
Jamie Curnow
2024-11-03 13:17:24 +10:00
parent a277a5d167
commit 6e820a36ac
35 changed files with 116 additions and 172 deletions

View File

@@ -5,19 +5,19 @@ import {
FormLabel,
Input,
Modal,
ModalOverlay,
ModalContent,
ModalHeader,
ModalCloseButton,
ModalBody,
ModalCloseButton,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
Stack,
useToast,
} from "@chakra-ui/react";
import { Formik, Form, Field } from "formik";
import { Field, Form, Formik } from "formik";
import { PrettyButton } from "src/components";
import { useUser, useSetUser } from "src/hooks";
import { useSetUser, useUser } from "src/hooks";
import { intl } from "src/locale";
import { validateEmail, validateString } from "src/modules/Validations";
@@ -59,7 +59,6 @@ function ProfileModal({ isOpen, onClose }: ProfileModalProps) {
<Formik
initialValues={{
name: user.data?.name,
nickname: user.data?.nickname,
email: user.data?.email,
}}
onSubmit={onSubmit}>
@@ -71,7 +70,7 @@ function ProfileModal({ isOpen, onClose }: ProfileModalProps) {
<ModalCloseButton />
<ModalBody>
<Stack spacing={4}>
<Field name="name" validate={validateString(2, 100)}>
<Field name="name" validate={validateString(2, 50)}>
{({ field, form }: any) => (
<FormControl
isRequired
@@ -91,30 +90,6 @@ function ProfileModal({ isOpen, onClose }: ProfileModalProps) {
</FormControl>
)}
</Field>
<Field name="nickname" validate={validateString(2, 100)}>
{({ field, form }: any) => (
<FormControl
isRequired
isInvalid={
form.errors.nickname && form.touched.nickname
}>
<FormLabel htmlFor="nickname">
{intl.formatMessage({ id: "user.nickname" })}
</FormLabel>
<Input
{...field}
id="nickname"
defaultValue={values.nickname}
placeholder={intl.formatMessage({
id: "user.nickname",
})}
/>
<FormErrorMessage>
{form.errors.nickname}
</FormErrorMessage>
</FormControl>
)}
</Field>
<Field name="email" validate={validateEmail()}>
{({ field, form }: any) => (
<FormControl

View File

@@ -35,7 +35,6 @@ import { validateEmail, validateString } from "src/modules/Validations";
interface Payload {
name: string;
nickname: string;
email: string;
password: string;
}
@@ -110,7 +109,6 @@ function UserCreateModal({ isOpen, onClose }: UserCreateModalProps) {
initialValues={
{
name: "",
nickname: "",
email: "",
password: "",
} as Payload
@@ -131,7 +129,7 @@ function UserCreateModal({ isOpen, onClose }: UserCreateModalProps) {
<TabPanels>
<TabPanel>
<Stack spacing={4}>
<Field name="name" validate={validateString(2, 100)}>
<Field name="name" validate={validateString(2, 50)}>
{({ field, form }: any) => (
<FormControl
isRequired
@@ -152,31 +150,6 @@ function UserCreateModal({ isOpen, onClose }: UserCreateModalProps) {
</FormControl>
)}
</Field>
<Field
name="nickname"
validate={validateString(2, 100)}>
{({ field, form }: any) => (
<FormControl
isRequired
isInvalid={
form.errors.nickname && form.touched.nickname
}>
<FormLabel htmlFor="nickname">
{intl.formatMessage({ id: "user.nickname" })}
</FormLabel>
<Input
{...field}
id="nickname"
placeholder={intl.formatMessage({
id: "user.nickname",
})}
/>
<FormErrorMessage>
{form.errors.nickname}
</FormErrorMessage>
</FormControl>
)}
</Field>
<Field name="email" validate={validateEmail()}>
{({ field, form }: any) => (
<FormControl

View File

@@ -8,28 +8,28 @@ import {
FormLabel,
Input,
Modal,
ModalOverlay,
ModalContent,
ModalHeader,
ModalCloseButton,
ModalBody,
ModalCloseButton,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
Stack,
Tab,
Tabs,
TabList,
TabPanel,
TabPanels,
Tabs,
useToast,
} from "@chakra-ui/react";
import { Formik, Form, Field } from "formik";
import { Field, Form, Formik } from "formik";
import {
AdminPermissionSelector,
PermissionSelector,
PrettyButton,
} from "src/components";
import { useUser, useSetUser } from "src/hooks";
import { useSetUser, useUser } from "src/hooks";
import { intl } from "src/locale";
import { validateEmail, validateString } from "src/modules/Validations";
@@ -106,7 +106,6 @@ function UserEditModal({ userId, isOpen, onClose }: UserEditModalProps) {
initialValues={
{
name: data?.name,
nickname: data?.nickname,
email: data?.email,
isDisabled: data?.isDisabled,
} as any
@@ -129,7 +128,7 @@ function UserEditModal({ userId, isOpen, onClose }: UserEditModalProps) {
<TabPanels>
<TabPanel>
<Stack spacing={4}>
<Field name="name" validate={validateString(2, 100)}>
<Field name="name" validate={validateString(2, 50)}>
{({ field, form }: any) => (
<FormControl
isRequired
@@ -152,31 +151,6 @@ function UserEditModal({ userId, isOpen, onClose }: UserEditModalProps) {
</FormControl>
)}
</Field>
<Field
name="nickname"
validate={validateString(2, 100)}>
{({ field, form }: any) => (
<FormControl
isRequired
isInvalid={
form.errors.nickname && form.touched.nickname
}>
<FormLabel htmlFor="nickname">
{intl.formatMessage({ id: "user.nickname" })}
</FormLabel>
<Input
{...field}
id="nickname"
placeholder={intl.formatMessage({
id: "user.nickname",
})}
/>
<FormErrorMessage>
{form.errors.nickname}
</FormErrorMessage>
</FormControl>
)}
</Field>
<Field name="email" validate={validateEmail()}>
{({ field, form }: any) => (
<FormControl