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:
21 files changed
+274
-86
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user