mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 03:45:53 -05:00
Added a secure password generator to admin customer user manager and
user account manager as shown below:
## Extra Details:
- Added a reusable password field component with:
- 17-character random password generation
- Uppercase and lowercase letters
- Numbers
- Symbols
- Password visibility toggle button
- Clipboard copy button after the new password is generated
- Integrated the feature into:
- Admin customer user creation area
- Admin customer user editing area
- Customer User account settings
<img width="430" height="466"
alt="{2DD29137-22E3-4446-8DB5-4F37AD322DF2}"
src="https://github.com/user-attachments/assets/03ef614a-3f4e-4ba6-bdbc-1a99e07959c6"
/>
<img width="427" height="120"
alt="{A3073146-78CD-459C-A837-EBAB72E8ABA4}"
src="https://github.com/user-attachments/assets/5c9cf583-4941-4c0d-893a-fe85c4e46f3c"
/>
<img width="413" height="142"
alt="{2DB05B11-7781-403D-ABC1-CEF11D31E1E8}"
src="https://github.com/user-attachments/assets/0131b770-9120-4f14-8bbd-8dfc374e6263"
/>
<img width="457" height="249"
alt="{8AA4DACE-CBA4-41F1-A5FA-F1EEB3B72632}"
src="https://github.com/user-attachments/assets/2f3004fe-74b2-4060-82eb-ac3f12d5f00f"
/>
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import { createFormHook, type AppFieldExtendedReactFormApi } from '@tanstack/react-form';
|
|
import type { FormAsyncValidateOrFn, FormValidateOrFn } from '@tanstack/form-core';
|
|
import { fieldContext, formContext } from './context';
|
|
import {
|
|
TextField,
|
|
PasswordField,
|
|
TextAreaField,
|
|
NumberField,
|
|
SelectField,
|
|
MultiSelectField,
|
|
SwitchField,
|
|
CheckboxField,
|
|
} from './fields';
|
|
import { SubmitButton } from './SubmitButton';
|
|
|
|
const fieldComponents = {
|
|
TextField,
|
|
PasswordField,
|
|
TextAreaField,
|
|
NumberField,
|
|
SelectField,
|
|
MultiSelectField,
|
|
SwitchField,
|
|
CheckboxField,
|
|
};
|
|
|
|
const formComponents = { SubmitButton };
|
|
|
|
export const { useAppForm } = createFormHook({
|
|
fieldContext,
|
|
formContext,
|
|
fieldComponents,
|
|
formComponents,
|
|
});
|
|
|
|
export { default as Form } from './Form';
|
|
export { useFormContext, useFieldContext } from './context';
|
|
export type { SelectOption } from './fields';
|
|
|
|
type SyncValidator<TFormData> = FormValidateOrFn<TFormData> | undefined;
|
|
type AsyncValidator<TFormData> = FormAsyncValidateOrFn<TFormData> | undefined;
|
|
|
|
/** Types a `form` prop for a sub-component that renders `<form.AppField>` of its parent's form. */
|
|
export type AppForm<TFormData, TSubmitMeta = unknown> = AppFieldExtendedReactFormApi<
|
|
TFormData,
|
|
SyncValidator<TFormData>,
|
|
SyncValidator<TFormData>,
|
|
AsyncValidator<TFormData>,
|
|
SyncValidator<TFormData>,
|
|
AsyncValidator<TFormData>,
|
|
SyncValidator<TFormData>,
|
|
AsyncValidator<TFormData>,
|
|
SyncValidator<TFormData>,
|
|
AsyncValidator<TFormData>,
|
|
AsyncValidator<TFormData>,
|
|
TSubmitMeta,
|
|
typeof fieldComponents,
|
|
typeof formComponents
|
|
>;
|