[FEATURE] Auto lowercase hosts

This commit is contained in:
Dunemask 2024-02-12 22:03:14 -07:00
parent f277764cc0
commit 981c22a112
2 changed files with 9 additions and 1 deletions

View file

@ -71,6 +71,9 @@ function payloadFilter(req, res) {
return res return res
.status(400) .status(400)
.send("Extra ports must be a list of strings with length of 5!"); .send("Extra ports must be a list of strings with length of 5!");
if (host !== host.toLowerCase())
WARN("CREATE", "Host automatically being lowercasified...");
req.body.host = host.toLowerCase();
return "filtered"; return "filtered";
} }

View file

@ -2,11 +2,16 @@ import TextField from "@mui/material/TextField";
export default function HostOption(props) { export default function HostOption(props) {
const { value, onChange, disabled } = props; const { value, onChange, disabled } = props;
function onTextChange(e) {
e.target.value = e.target.value.toLowerCase();
onChange(e);
}
return ( return (
<TextField <TextField
label="Host" label="Host"
value={value ?? ""} value={value ?? ""}
onChange={onChange} onChange={onTextChange}
helperText="Example: host.mydomain.com" helperText="Example: host.mydomain.com"
FormHelperTextProps={{ sx: { ml: 0 } }} FormHelperTextProps={{ sx: { ml: 0 } }}
required required