mirror of
https://github.com/JetSprow/J-Board-Lite.git
synced 2026-05-01 09:14:11 +05:30
merge main into dev
This commit is contained in:
@@ -9,6 +9,7 @@ import { actorFromSession, recordAuditLog } from "@/services/audit";
|
||||
import { getAppConfig } from "@/services/app-config";
|
||||
import { normalizeSiteUrl } from "@/services/site-url";
|
||||
import { encrypt } from "@/lib/crypto";
|
||||
import { getErrorMessage } from "@/lib/errors";
|
||||
import { sendSmtpTestEmail } from "@/services/email";
|
||||
|
||||
const settingsSchema = z.object({
|
||||
@@ -65,15 +66,10 @@ type SmtpTestActionResult =
|
||||
|
||||
function formatActionError(error: unknown, fallback: string) {
|
||||
if (error instanceof z.ZodError) {
|
||||
return error.issues[0]?.message ?? fallback;
|
||||
const details = error.issues.map((issue) => issue.message).filter(Boolean).join(";");
|
||||
return details || getErrorMessage(error, fallback);
|
||||
}
|
||||
if (error instanceof Error && error.message.trim()) {
|
||||
return error.message.trim();
|
||||
}
|
||||
if (typeof error === "string" && error.trim()) {
|
||||
return error.trim();
|
||||
}
|
||||
return fallback;
|
||||
return getErrorMessage(error, fallback);
|
||||
}
|
||||
|
||||
async function assertSmtpTestRateLimit(userId: string) {
|
||||
|
||||
@@ -26,7 +26,7 @@ export async function createUser(formData: FormData) {
|
||||
const data = createUserSchema.parse(Object.fromEntries(formData));
|
||||
const hashed = await bcrypt.hash(data.password, 12);
|
||||
const user = await prisma.user.create({
|
||||
data: { email: data.email, password: hashed, name: data.name || null, role: data.role },
|
||||
data: { email: data.email, emailVerifiedAt: new Date(), password: hashed, name: data.name || null, role: data.role },
|
||||
});
|
||||
await recordAuditLog({
|
||||
actor: actorFromSession(session),
|
||||
|
||||
Reference in New Issue
Block a user