diff --git a/AquaNet/src/components/BindCard.svelte b/AquaNet/src/components/BindCard.svelte index cc0df88a..f2af48a2 100644 --- a/AquaNet/src/components/BindCard.svelte +++ b/AquaNet/src/components/BindCard.svelte @@ -7,14 +7,25 @@ const inputACRegex = /^(\d{4} ){0,4}\d{0,4}$/ const inputACRegexFull = /^(\d{4} ){4}\d{4}$/ let inputAC = "" - let inputSN = "" function inputACChange(e: any) { e = e as InputEvent // Add spaces to the input - if (e.inputType === "insertText" && inputAC.length % 5 === 4 && inputAC.length < 20) { + if (e.inputType === "insertText" && inputAC.length % 5 === 4 && inputAC.length < 24) inputAC += " " - } + inputAC = inputAC.slice(0, 24) + } + + const inputSNRegex = /^([0-9A-Fa-f]{0,2}:){0,7}[0-9A-Fa-f]{0,2}$/ + const inputSNRegexFull = /^([0-9A-Fa-f]{2}:){7}[0-9A-Fa-f]{2}$/ + let inputSN = "" + + function inputSNChange(e: any) { + e = e as InputEvent + // Add colons to the input + if (e.inputType === "insertText" && inputSN.length % 3 === 2 && inputSN.length < 23) + inputSN += ":" + inputSN = inputSN.toUpperCase().slice(0, 23) } @@ -36,7 +47,15 @@ (Android / Apple) and scan your card. Then, enter the Serial Number.
- +