feat(dashboard): customize character length in graphical captcha (cloudreve/cloudreve#2879)

This commit is contained in:
Aaron Liu 2025-09-12 14:31:01 +08:00
parent dcf21d5eb9
commit 2db256607a
12 changed files with 38 additions and 5 deletions

View File

@ -473,6 +473,7 @@
"captchaWidth": "Breite", "captchaWidth": "Breite",
"captchaHeight": "Höhe", "captchaHeight": "Höhe",
"captchaLength": "Länge", "captchaLength": "Länge",
"captchaLengthDes": "Die Länge der Zeichen im Captcha.",
"captchaMode": "Modus", "captchaMode": "Modus",
"captchaModeNumber": "Zahlen", "captchaModeNumber": "Zahlen",
"captchaModeLetter": "Buchstaben", "captchaModeLetter": "Buchstaben",

View File

@ -472,6 +472,7 @@
"captchaWidth": "Width", "captchaWidth": "Width",
"captchaHeight": "Height", "captchaHeight": "Height",
"captchaLength": "Length", "captchaLength": "Length",
"captchaLengthDes": "The length of characters in the captcha.",
"captchaMode": "Mode", "captchaMode": "Mode",
"captchaModeNumber": "Numbers", "captchaModeNumber": "Numbers",
"captchaModeLetter": "Letters", "captchaModeLetter": "Letters",

View File

@ -473,6 +473,7 @@
"captchaWidth": "Ancho", "captchaWidth": "Ancho",
"captchaHeight": "Altura", "captchaHeight": "Altura",
"captchaLength": "Longitud", "captchaLength": "Longitud",
"captchaLengthDes": "La longitud de los caracteres en el captcha.",
"captchaMode": "Modo", "captchaMode": "Modo",
"captchaModeNumber": "Números", "captchaModeNumber": "Números",
"captchaModeLetter": "Letras", "captchaModeLetter": "Letras",

View File

@ -473,6 +473,7 @@
"captchaWidth": "Largeur", "captchaWidth": "Largeur",
"captchaHeight": "Hauteur", "captchaHeight": "Hauteur",
"captchaLength": "Longueur", "captchaLength": "Longueur",
"captchaLengthDes": "La longueur des caractères dans le captcha.",
"captchaMode": "Mode", "captchaMode": "Mode",
"captchaModeNumber": "Chiffres", "captchaModeNumber": "Chiffres",
"captchaModeLetter": "Lettres", "captchaModeLetter": "Lettres",

View File

@ -473,6 +473,7 @@
"captchaWidth": "Larghezza", "captchaWidth": "Larghezza",
"captchaHeight": "Altezza", "captchaHeight": "Altezza",
"captchaLength": "Lunghezza", "captchaLength": "Lunghezza",
"captchaLengthDes": "La lunghezza dei caratteri nel captcha.",
"captchaMode": "Modalità", "captchaMode": "Modalità",
"captchaModeNumber": "Numeri", "captchaModeNumber": "Numeri",
"captchaModeLetter": "Lettere", "captchaModeLetter": "Lettere",

View File

@ -472,6 +472,7 @@
"captchaWidth": "幅", "captchaWidth": "幅",
"captchaHeight": "高さ", "captchaHeight": "高さ",
"captchaLength": "長さ", "captchaLength": "長さ",
"captchaLengthDes": "キャプチャ内の文字の長さ。",
"captchaMode": "モード", "captchaMode": "モード",
"captchaModeNumber": "数字", "captchaModeNumber": "数字",
"captchaModeLetter": "アルファベット", "captchaModeLetter": "アルファベット",

View File

@ -472,6 +472,7 @@
"captchaWidth": "너비", "captchaWidth": "너비",
"captchaHeight": "높이", "captchaHeight": "높이",
"captchaLength": "길이", "captchaLength": "길이",
"captchaLengthDes": "캡차 내 문자의 길이입니다.",
"captchaMode": "모드", "captchaMode": "모드",
"captchaModeNumber": "숫자", "captchaModeNumber": "숫자",
"captchaModeLetter": "문자", "captchaModeLetter": "문자",

View File

@ -473,6 +473,7 @@
"captchaWidth": "Largura", "captchaWidth": "Largura",
"captchaHeight": "Altura", "captchaHeight": "Altura",
"captchaLength": "Comprimento", "captchaLength": "Comprimento",
"captchaLengthDes": "O comprimento dos caracteres no captcha.",
"captchaMode": "Modo", "captchaMode": "Modo",
"captchaModeNumber": "Números", "captchaModeNumber": "Números",
"captchaModeLetter": "Letras", "captchaModeLetter": "Letras",

View File

@ -473,6 +473,7 @@
"captchaWidth": "Ширина", "captchaWidth": "Ширина",
"captchaHeight": "Высота", "captchaHeight": "Высота",
"captchaLength": "Длина", "captchaLength": "Длина",
"captchaLengthDes": "Длина символов в капче.",
"captchaMode": "Режим", "captchaMode": "Режим",
"captchaModeNumber": "Цифры", "captchaModeNumber": "Цифры",
"captchaModeLetter": "Буквы", "captchaModeLetter": "Буквы",

View File

@ -472,6 +472,7 @@
"captchaWidth": "宽度", "captchaWidth": "宽度",
"captchaHeight": "高度", "captchaHeight": "高度",
"captchaLength": "长度", "captchaLength": "长度",
"captchaLengthDes": "验证码中字符的长度。",
"captchaMode": "模式", "captchaMode": "模式",
"captchaModeNumber": "数字", "captchaModeNumber": "数字",
"captchaModeLetter": "字母", "captchaModeLetter": "字母",

View File

@ -472,6 +472,7 @@
"captchaWidth": "寬度", "captchaWidth": "寬度",
"captchaHeight": "高度", "captchaHeight": "高度",
"captchaLength": "長度", "captchaLength": "長度",
"captchaLengthDes": "驗證碼中字符的長度。",
"captchaMode": "模式", "captchaMode": "模式",
"captchaModeNumber": "數字", "captchaModeNumber": "數字",
"captchaModeLetter": "字母", "captchaModeLetter": "字母",

View File

@ -1,10 +1,10 @@
import { Collapse, FormControl, FormControlLabel, ListItemText, Stack, Switch } from "@mui/material";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { FormControl, FormControlLabel, ListItemText, Stack, Switch } from "@mui/material";
import SettingForm from "../../../Pages/Setting/SettingForm.tsx";
import { DenseSelect } from "../../../Common/StyledComponents.tsx";
import { SquareMenuItem } from "../../../FileManager/ContextMenu/ContextMenu.tsx";
import * as React from "react";
import { isTrueVal } from "../../../../session/utils.ts"; import { isTrueVal } from "../../../../session/utils.ts";
import { DenseFilledTextField, DenseSelect } from "../../../Common/StyledComponents.tsx";
import { SquareMenuItem } from "../../../FileManager/ContextMenu/ContextMenu.tsx";
import SettingForm from "../../../Pages/Setting/SettingForm.tsx";
import { NoMarginHelperText } from "../Settings.tsx";
export interface GraphicCaptchaProps { export interface GraphicCaptchaProps {
values: { values: {
@ -41,6 +41,28 @@ const GraphicCaptcha = ({ values, setSettings }: GraphicCaptchaProps) => {
</DenseSelect> </DenseSelect>
</FormControl> </FormControl>
</SettingForm> </SettingForm>
<Collapse in={values.captcha_mode !== "2"} unmountOnExit>
<SettingForm title={t("settings.captchaLength")} lgWidth={5}>
<FormControl>
<DenseFilledTextField
value={values.captcha_CaptchaLen}
slotProps={{
htmlInput: {
type: "number",
min: 1,
max: 10,
},
}}
onChange={(e) =>
setSettings({
captcha_CaptchaLen: e.target.value,
})
}
/>
<NoMarginHelperText>{t("settings.captchaLengthDes")}</NoMarginHelperText>
</FormControl>
</SettingForm>
</Collapse>
{[ {[
{ {
name: "complexOfNoiseText", name: "complexOfNoiseText",