fix: added better UI form validation for password registration
This commit is contained in:
@@ -888,7 +888,11 @@ app.post(
|
||||
authRateLimit,
|
||||
async (req, reply) => {
|
||||
const parsed = RegisterBody.safeParse(req.body);
|
||||
if (!parsed.success) return reply.code(400).send({ ok: false, message: "Invalid payload" });
|
||||
if (!parsed.success) {
|
||||
const firstIssue = parsed.error.issues[0];
|
||||
const message = firstIssue?.message || "Invalid payload";
|
||||
return reply.code(400).send({ ok: false, message });
|
||||
}
|
||||
const { email, password } = parsed.data;
|
||||
const normalizedEmail = normalizeEmail(email);
|
||||
const existing = await app.prisma.user.findUnique({
|
||||
|
||||
Reference in New Issue
Block a user