mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-19 07:55:25 +02:00
feat: Add allow registration field to admin settings
This commit is contained in:
parent
2081a385a3
commit
7a2df877b7
@ -66,6 +66,10 @@
|
|||||||
"maxAliasesPerUser": {
|
"maxAliasesPerUser": {
|
||||||
"label": "Maximum aliases per user",
|
"label": "Maximum aliases per user",
|
||||||
"description": "The maximum number of aliases a user can create. 0 means unlimited. Existing aliases will not be affected."
|
"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,
|
allowStatistics: true,
|
||||||
allowAliasDeletion: false,
|
allowAliasDeletion: false,
|
||||||
maxAliasesPerUser: 0,
|
maxAliasesPerUser: 0,
|
||||||
|
allowRegistrations: true,
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
|
|||||||
allowStatistics: yup.boolean().label(t("fields.allowStatistics.label")),
|
allowStatistics: yup.boolean().label(t("fields.allowStatistics.label")),
|
||||||
allowAliasDeletion: yup.boolean().label(t("fields.allowAliasDeletion.label")),
|
allowAliasDeletion: yup.boolean().label(t("fields.allowAliasDeletion.label")),
|
||||||
maxAliasesPerUser: yup.number().label(t("fields.maxAliasesPerUser.label")).min(0),
|
maxAliasesPerUser: yup.number().label(t("fields.maxAliasesPerUser.label")).min(0),
|
||||||
|
allowRegistrations: yup.boolean().label(t("fields.allowRegistrations.label")),
|
||||||
} as Record<keyof AdminSettings, any>)
|
} as Record<keyof AdminSettings, any>)
|
||||||
|
|
||||||
const {mutateAsync} = useMutation<
|
const {mutateAsync} = useMutation<
|
||||||
@ -520,6 +521,31 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
|
|||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</Grid>
|
</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>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
|
@ -241,6 +241,7 @@ export interface AdminSettings {
|
|||||||
allowStatistics: boolean
|
allowStatistics: boolean
|
||||||
allowAliasDeletion: boolean
|
allowAliasDeletion: boolean
|
||||||
maxAliasesPerUser: number
|
maxAliasesPerUser: number
|
||||||
|
allowRegistrations: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ServerCronReport {
|
export interface ServerCronReport {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user