diff --git a/CHANGELOG.md b/CHANGELOG.md index 904fc8f..ce30d1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Prevent a machine from changing its owner to itself (closes [#373](https://github.com/tale/headplane/issues/373)). - Added an `/admin/api/info` route that can expose sensitive information if `server.info_secret` is set in the configuration (closes [#324](https://github.com/tale/headplane/issues/324)). - Correctly apply Gravatar profile pictures on the user page if applicable (closes [#405](https://github.com/tale/headplane/issues/405)). +- Machine key registration no longer works if the key isn't 24 characters long (closes [#415](https://github.com/tale/headplane/issues/415)). --- # 0.6.1 (October 12, 2025) diff --git a/app/components/Dialog.tsx b/app/components/Dialog.tsx index d30d25c..9eb4e78 100644 --- a/app/components/Dialog.tsx +++ b/app/components/Dialog.tsx @@ -107,6 +107,11 @@ function Panel(props: DialogPanelProps) { return (
{ if (onSubmit) { onSubmit(event); @@ -114,12 +119,7 @@ function Panel(props: DialogPanelProps) { close?.(); }} - method={method ?? 'POST'} ref={ref} - className={cn( - 'outline-hidden rounded-3xl w-full max-w-lg', - 'bg-white dark:bg-headplane-900', - )} > {children} @@ -130,9 +130,9 @@ function Panel(props: DialogPanelProps) { <> diff --git a/app/components/Input.tsx b/app/components/Input.tsx index a402263..efa1252 100644 --- a/app/components/Input.tsx +++ b/app/components/Input.tsx @@ -8,11 +8,18 @@ export interface InputProps extends AriaTextFieldProps { labelHidden?: boolean; isRequired?: boolean; className?: string; + isInvalid?: boolean; + errorMessage?: string; } -// TODO: Custom isInvalid logic for custom error messages export default function Input(props: InputProps) { - const { label, labelHidden, className } = props; + const { + label, + labelHidden, + className, + isInvalid: customIsInvalid, + errorMessage, + } = props; const ref = useRef(null); const id = useId(props.id); @@ -21,7 +28,7 @@ export default function Input(props: InputProps) { inputProps, descriptionProps, errorMessageProps, - isInvalid, + isInvalid: ariaIsInvalid, validationErrors, } = useTextField( { @@ -32,16 +39,18 @@ export default function Input(props: InputProps) { ref, ); + const isInvalid = customIsInvalid ?? ariaIsInvalid; + return ( -
+
{props.description && (
- {validationErrors.join(' ')} + {errorMessage ?? validationErrors.join(' ')}
) : null}
diff --git a/app/routes/machines/dialogs/new.tsx b/app/routes/machines/dialogs/new.tsx index 53e74a9..bb9bddb 100644 --- a/app/routes/machines/dialogs/new.tsx +++ b/app/routes/machines/dialogs/new.tsx @@ -20,10 +20,12 @@ export default function NewMachine(data: NewMachineProps) { const [mkey, setMkey] = useState(''); const navigate = useNavigate(); + const isMkeyInvalid = mkey.length > 0 && mkey.length !== 24; + return ( <> - + Register Machine Key The machine key is given when you run{' '} @@ -32,6 +34,8 @@ export default function NewMachine(data: NewMachineProps) {