fix(auth): resolve credentials login SQLITE_CONSTRAINT_NOTNULL and relax password rules

Session creation failed with NOT NULL constraint on expires column due to
invalid date propagation from duration parsing. Override adapter.createSession
with validated insert, harden signIn callback, fix createDurationSchema for
numeric-only values, and guard events.ts group insert.

Also relaxes password complexity to suggestions-only (min 8 chars enforced),
extracts shared UserCreatePasswordFields component, and fixes login form
passing extra fields to signIn.
This commit is contained in:
Thomas Camlong committed 2026-05-21 16:30:07 +02:00
1 parent dade477b32
commit 27325326da
21 files changed
+274 -86

No files matched your search

+13
View File
@@ -11,6 +11,19 @@ export const createAdapter = (db: Database, provider: SupportedAuthProvider | "u
return {
...drizzleAdapter,
createSession: (data) => {
const result = db
.insert(sessions)
.values({
sessionToken: data.sessionToken,
userId: data.userId,
expires: data.expires,
})
.returning()
.get();
return result;
},
// We override the default implementation as we want to have a provider
// flag in the user instead of the account to not intermingle users from different providers
// eslint-disable-next-line no-restricted-syntax