refactor testing
Some checks failed
ci/woodpecker/pr/pr Pipeline failed

This commit is contained in:
Madison Grubb
2026-02-17 11:05:57 -05:00
parent b0e8dd7ad9
commit 1a566e2d80
57 changed files with 1127 additions and 1760 deletions

View File

@@ -1,3 +1,3 @@
import { getAuthConfig } from '../../utils/authConfig.js'
import { getAuthConfig } from '../../utils/oidc.js'
export default defineEventHandler(() => getAuthConfig())

View File

@@ -1,7 +1,7 @@
import { setCookie } from 'h3'
import { getDb } from '../../utils/db.js'
import { verifyPassword } from '../../utils/password.js'
import { getSessionMaxAgeDays } from '../../utils/session.js'
import { getSessionMaxAgeDays } from '../../utils/constants.js'
export default defineEventHandler(async (event) => {
const body = await readBody(event)
@@ -15,10 +15,10 @@ export default defineEventHandler(async (event) => {
if (!user || !user.password_hash || !verifyPassword(password, user.password_hash)) {
throw createError({ statusCode: 401, message: 'Invalid credentials' })
}
// Invalidate all existing sessions for this user to prevent session fixation
await run('DELETE FROM sessions WHERE user_id = ?', [user.id])
const sessionDays = getSessionMaxAgeDays()
const sid = crypto.randomUUID()
const now = new Date()

View File

@@ -1,5 +1,5 @@
import { getAuthConfig } from '../../../utils/authConfig.js'
import {
getAuthConfig,
getOidcConfig,
getOidcRedirectUri,
createOidcParams,

View File

@@ -6,7 +6,7 @@ import {
exchangeCode,
} from '../../../utils/oidc.js'
import { getDb } from '../../../utils/db.js'
import { getSessionMaxAgeDays } from '../../../utils/session.js'
import { getSessionMaxAgeDays } from '../../../utils/constants.js'
const DEFAULT_ROLE = process.env.OIDC_DEFAULT_ROLE || 'member'
@@ -76,7 +76,7 @@ export default defineEventHandler(async (event) => {
// Invalidate all existing sessions for this user to prevent session fixation
await run('DELETE FROM sessions WHERE user_id = ?', [user.id])
const sessionDays = getSessionMaxAgeDays()
const sid = crypto.randomUUID()
const now = new Date()