Add missing migrations
CI / check (push) Failing after 26s
CI / deploy (push) Skipped
CI / release (push) Skipped

This commit is contained in:
openhands committed 2026-08-26 14:28:28 +02:00
1 parent 0201d21c38
commit 2d09a4a92c
3 files changed
+90 -3

No files matched your search

+19 -3
View File
@@ -29,6 +29,7 @@ const registerSchema = z.object({
.regex(/[A-Z]/, "Password must contain at least one uppercase letter")
.regex(/[a-z]/, "Password must contain at least one lowercase letter")
.regex(/[0-9]/, "Password must contain at least one digit"),
passwordConfirmation: z.string(),
look: z.string().optional(),
});
@@ -48,6 +49,9 @@ export async function register(
.trim()
.toLowerCase(),
password: String(formData.get("password") ?? "").normalize("NFC"),
passwordConfirmation: String(
formData.get("password_confirmation") ?? "",
).normalize("NFC"),
look:
String(formData.get("look") ?? "")
.normalize("NFC")
@@ -60,6 +64,10 @@ export async function register(
return parsed.error.issues[0]?.message ?? "Invalid input";
}
if (parsed.data.password !== parsed.data.passwordConfirmation) {
return "Passwords do not match";
}
const { username, mail, password, look } = parsed.data;
const hasEmail = !!mail;
const ip = await clientIp();
@@ -124,6 +132,7 @@ export async function register(
ipRegister: ip,
ipCurrent: ip,
look,
termsAccepted: raw.termsAccepted,
});
if (hasEmail) {
@@ -133,9 +142,16 @@ export async function register(
logger.warn("Failed to send verification email after registration");
}
}
} catch {
logger.warn("Account creation failed");
return "Could not create the account (is the username unique?)";
} catch (err) {
const code = (err as { cause?: { code?: string } }).cause?.code;
if (code === "ER_DUP_ENTRY") {
return "That username is already taken";
}
logger.error("Account creation failed", {
code,
message: err instanceof Error ? err.message : String(err),
});
return "Could not create the account. Please try again or contact staff.";
}
redirect("/login?registered=1");