This commit is contained in:
jarek committed 2026-03-02 07:59:58 +01:00
1 parent 4b430340db
commit 9c451aedf9
120 files changed
+7777 -6046

No files matched your search

+2 -2
View File
@@ -114,7 +114,7 @@ export const POST: RequestHandler = async (event) => {
// Auto-login if this is the first user being created (and auth is enabled)
let autoLoggedIn = false;
if (isFirstUser && auth.authEnabled) {
await createUserSession(user.id, 'local', cookies);
await createUserSession(user.id, 'local', cookies, event.request);
autoLoggedIn = true;
}
@@ -139,7 +139,7 @@ export const POST: RequestHandler = async (event) => {
name: error.name,
stack: error.stack
});
if (error.message?.includes('UNIQUE constraint failed') || error.code === '23505') {
if (error.message?.includes('UNIQUE constraint failed') || error.code === '23505' || (error as any).cause?.code === '23505') {
return json({ error: 'Username already exists' }, { status: 409 });
}
return json({ error: 'Failed to create user', details: error.message }, { status: 500 });
+1 -1
View File
@@ -229,7 +229,7 @@ export const PUT: RequestHandler = async (event) => {
});
} catch (error: any) {
console.error('Failed to update user:', error);
if (error.message?.includes('UNIQUE constraint failed')) {
if (error.message?.includes('UNIQUE constraint failed') || (error as any).cause?.code === '23505') {
return json({ error: 'Username already exists' }, { status: 409 });
}
return json({ error: 'Failed to update user' }, { status: 500 });