Redis + RateLimiting Unit Test

This commit is contained in:
2024-04-24 10:11:54 +02:00
parent c13516c085
commit 18bb6bffa7
7 changed files with 202 additions and 10 deletions

View File

@@ -8,17 +8,28 @@ export default function SettingsSelection(props) {
const {key_name, value, options, onChangeValue, disabled, ...other} = props;
const {translate: L} = useContext(LocaleContext);
let optionElements = [];
if (Array.isArray(options)) {
optionElements = options.map(option => <option
key={"option-" + option}
value={option}>
{option}
</option>);
} else {
optionElements = Object.entries(options).map(([value, label]) => <option
key={"option-" + value}
value={value}>
{label}
</option>);
}
return <SpacedFormGroup {...other}>
<FormLabel disabled={disabled}>{L("settings." + key_name)}</FormLabel>
<FormControl>
<Select native value={value}
disabled={disabled}
size={"small"} onChange={e => onChangeValue(e.target.value)}>
{options.map(option => <option
key={"option-" + option}
value={option}>
{option}
</option>)}
{optionElements}
</Select>
</FormControl>
</SpacedFormGroup>

View File

@@ -284,7 +284,7 @@ export default function SettingsView(props) {
];
} else if (selectedTab === "captcha") {
return [
renderSelection("captcha_provider", ["none", "recaptcha", "hcaptcha"]),
renderSelection("captcha_provider", {"none": L("settings.none"), "recaptcha": "Google reCaptcha", "hcaptcha": "hCaptcha"}),
renderTextInput("captcha_site_key", settings.captcha_provider === "none"),
renderPasswordInput("captcha_secret_key", settings.captcha_provider === "none"),
];