Redis + RateLimiting Unit Test
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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"),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user