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

@ -8,7 +8,6 @@ export interface AuthOptions {
export interface NewUser {
name: string;
nickname: string;
email: string;
isDisabled: boolean;
auth: AuthOptions;

View File

@ -14,7 +14,6 @@ export interface UserAuth {
export interface User {
id: number;
name: string;
nickname: string;
email: string;
createdOn: number;
updatedOn: number;

View File

@ -185,6 +185,9 @@
"error.email-already-exists": {
"defaultMessage": "Es existiert bereits ein Benutzer mit dieser E-Mail-Adresse"
},
"error.invalid-auth-type": {
"defaultMessage": "Invalid authentication type"
},
"error.invalid-login-credentials": {
"defaultMessage": "Ungültige Login-Details"
},
@ -440,9 +443,6 @@
"user.name": {
"defaultMessage": "Name"
},
"user.nickname": {
"defaultMessage": "Benutzername"
},
"user.password": {
"defaultMessage": "Passwort"
},

View File

@ -461,6 +461,9 @@
"error.email-already-exists": {
"defaultMessage": "A user already exists with this email address"
},
"error.invalid-auth-type": {
"defaultMessage": "Invalid authentication type"
},
"error.invalid-login-credentials": {
"defaultMessage": "Invalid login credentials"
},
@ -722,9 +725,6 @@
"user.name": {
"defaultMessage": "Name"
},
"user.nickname": {
"defaultMessage": "Nickname"
},
"user.password": {
"defaultMessage": "Password"
},

View File

@ -185,6 +185,9 @@
"error.email-already-exists": {
"defaultMessage": "کاربری از قبل با این آدرس ایمیل وجود دارد"
},
"error.invalid-auth-type": {
"defaultMessage": "Invalid authentication type"
},
"error.invalid-login-credentials": {
"defaultMessage": "اعتبار ورود نامعتبر است"
},
@ -443,9 +446,6 @@
"user.name": {
"defaultMessage": "نام"
},
"user.nickname": {
"defaultMessage": "کنیه"
},
"user.password": {
"defaultMessage": "کلمه عبور"
},

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

View File

@ -1,10 +1,9 @@
import { useEffect, useMemo, useState } from "react";
import { FiDownload, FiEdit, FiRefreshCw, FiTrash2 } from "react-icons/fi";
import { useSortBy, useFilters, useTable, usePagination } from "react-table";
import { useFilters, usePagination, useSortBy, useTable } from "react-table";
import {
tableEvents,
ActionsFormatter,
CertificateStatusFormatter,
CertificateTypeFormatter,
@ -12,6 +11,7 @@ import {
GravatarFormatter,
IDFormatter,
MonospaceFormatter,
tableEvents,
TableFilter,
TableLayout,
TablePagination,
@ -123,7 +123,7 @@ function Table({
},
];
return [columns, data];
}, [data, onRenewal]);
}, [data, onRenewal, onDelete]);
const tableInstance = useTable(
{

View File

@ -25,7 +25,6 @@ import { validateEmail, validateString } from "src/modules/Validations";
interface Payload {
name: string;
nickname: string;
email: string;
password: string;
}
@ -122,7 +121,6 @@ function Setup() {
initialValues={
{
name: "",
nickname: "",
email: "",
password: "",
} as Payload
@ -131,7 +129,7 @@ function Setup() {
{({ isSubmitting }) => (
<Form>
<Stack spacing={4}>
<Field name="name" validate={validateString(2, 100)}>
<Field name="name" validate={validateString(2, 50)}>
{({ field, form }: any) => (
<FormControl
isRequired
@ -153,29 +151,6 @@ function Setup() {
</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