fix: 8 groups of 8 chars, not 16 groups of 4

This commit is contained in:
M1 2026-03-17 06:26:14 +04:00
parent 43a1abc2ed
commit bbd5df8c46
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@
<form id="login-form" action="/account/login" method="POST">
<input type="hidden" name="_form" value="1">
<label class="block text-xs text-gray-500 uppercase tracking-wider mb-2">Account Key</label>
<input id="key-input" name="key" type="text" placeholder="XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX" autocomplete="off" spellcheck="false"
<input id="key-input" name="key" type="text" placeholder="XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX" autocomplete="off" spellcheck="false"
class="w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-3 text-gray-100 placeholder-gray-600 focus:outline-none focus:border-blue-500 text-sm font-mono tracking-wider"
maxlength="71">
<button type="submit"

View File

@ -4,8 +4,8 @@ import sql from "../db";
function generateKey(): string {
const hex = randomBytes(32).toString("hex"); // 64 hex chars
// Format as 8 groups of 4: XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX
return (hex.match(/.{4}/g) as string[]).join("-").toUpperCase();
// Format as 8 groups of 8: XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX
return (hex.match(/.{8}/g) as string[]).join("-").toUpperCase();
}
function normalizeKey(raw: string): string {