diff --git a/js/components/operatorSignIn/attestation.tsx b/js/components/operatorSignIn/attestation.tsx index 87f0222..ed086be 100644 --- a/js/components/operatorSignIn/attestation.tsx +++ b/js/components/operatorSignIn/attestation.tsx @@ -3,6 +3,7 @@ import { reload } from "../../browser"; import { lookupDisplayName } from "../../hooks/useEmployees"; import { Employee } from "../../models/employee"; import { className } from "../../util/dom"; +import { removeLeadingZero } from "../../util/string"; import { useSignInText } from "./text"; import { ReactElement, useEffect, useState } from "react"; @@ -157,8 +158,9 @@ export const SignaturePrompt = ({ className="fs-mask w-full" inputMode="numeric" defaultValue={defaultValue} + // Do not set `value`- we are transforming below! onChange={(evt) => { - onChange(evt.target.value); + onChange(removeLeadingZero(evt.target.value)); }} required /> diff --git a/js/components/operatorSignIn/operatorSelection.tsx b/js/components/operatorSignIn/operatorSelection.tsx index b6934ab..68c1e0e 100644 --- a/js/components/operatorSignIn/operatorSelection.tsx +++ b/js/components/operatorSignIn/operatorSelection.tsx @@ -1,6 +1,7 @@ import { fetchEmployeeByBadgeSerial } from "../../hooks/useEmployees"; import { useNfc } from "../../hooks/useNfc"; import { className } from "../../util/dom"; +import { removeLeadingZero } from "../../util/string"; import { BadgeEntry } from "./types"; import { ReactElement, useEffect, useId, useState } from "react"; @@ -51,8 +52,12 @@ export const OperatorSelection = ({ className="fs-mask h-10" id={inputId} inputMode="numeric" + // Do not set `value`- we are transforming below! onChange={(evt) => { - setBadgeEntry({ number: evt.target.value, method: "manual" }); + setBadgeEntry({ + number: removeLeadingZero(evt.target.value), + method: "manual", + }); }} />