mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-18 23:45:26 +02:00
feat: Add allow registration field to admin settings
This commit is contained in:
parent
2081a385a3
commit
7a2df877b7
@ -66,6 +66,10 @@
|
||||
"maxAliasesPerUser": {
|
||||
"label": "Maximum aliases per user",
|
||||
"description": "The maximum number of aliases a user can create. 0 means unlimited. Existing aliases will not be affected."
|
||||
},
|
||||
"allowRegistrations": {
|
||||
"label": "Allow registrations",
|
||||
"description": "If enabled, users will be able to register on your instance. This only affects new account registrations."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,5 @@ export const DEFAULT_ADMIN_SETTINGS: AdminSettings = {
|
||||
allowStatistics: true,
|
||||
allowAliasDeletion: false,
|
||||
maxAliasesPerUser: 0,
|
||||
allowRegistrations: true,
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
|
||||
allowStatistics: yup.boolean().label(t("fields.allowStatistics.label")),
|
||||
allowAliasDeletion: yup.boolean().label(t("fields.allowAliasDeletion.label")),
|
||||
maxAliasesPerUser: yup.number().label(t("fields.maxAliasesPerUser.label")).min(0),
|
||||
allowRegistrations: yup.boolean().label(t("fields.allowRegistrations.label")),
|
||||
} as Record<keyof AdminSettings, any>)
|
||||
|
||||
const {mutateAsync} = useMutation<
|
||||
@ -520,6 +521,31 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
|
||||
</FormHelperText>
|
||||
</FormGroup>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<FormGroup key="allow_registrations">
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={formik.values.allowRegistrations}
|
||||
onChange={formik.handleChange}
|
||||
name="allowRegistrations"
|
||||
/>
|
||||
}
|
||||
disabled={formik.isSubmitting}
|
||||
label={t("fields.allowRegistrations.label")}
|
||||
/>
|
||||
<FormHelperText
|
||||
error={
|
||||
formik.touched.allowRegistrations &&
|
||||
Boolean(formik.errors.allowRegistrations)
|
||||
}
|
||||
>
|
||||
{(formik.touched.allowRegistrations &&
|
||||
formik.errors.allowRegistrations) ||
|
||||
t("fields.allowRegistrations.description")}
|
||||
</FormHelperText>
|
||||
</FormGroup>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
|
@ -241,6 +241,7 @@ export interface AdminSettings {
|
||||
allowStatistics: boolean
|
||||
allowAliasDeletion: boolean
|
||||
maxAliasesPerUser: number
|
||||
allowRegistrations: boolean
|
||||
}
|
||||
|
||||
export interface ServerCronReport {
|
||||
|
Loading…
x
Reference in New Issue
Block a user