feat: add admin authenticator 2FA and configurable login email alerts

This commit is contained in:
Sascha Nesterovic committed 2026-10-25 10:36:15 +01:00
1 parent bee3b990f9
commit 52cc865140
21 files changed
+1961 -20

No files matched your search

+32
View File
@@ -1,5 +1,34 @@
import { defineConfig, devices } from '@playwright/test';
import { randomBytes } from 'node:crypto';
import { execFileSync } from 'node:child_process';
import { existsSync, mkdirSync, mkdtempSync } from 'node:fs';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
process.env.TEST_TLS_DIR ??= mkdtempSync(join(tmpdir(), 'hamham-tls-'));
mkdirSync(process.env.TEST_TLS_DIR, { recursive: true });
const testCert = join(process.env.TEST_TLS_DIR, 'cert.pem');
if (!existsSync(testCert))
execFileSync(
'openssl',
[
'req',
'-x509',
'-newkey',
'rsa:2048',
'-nodes',
'-days',
'1',
'-keyout',
join(process.env.TEST_TLS_DIR, 'key.pem'),
'-out',
testCert,
'-subj',
'/CN=localhost',
'-addext',
'subjectAltName=DNS:localhost,IP:127.0.0.1',
],
{ stdio: 'ignore' },
);
process.env.TEST_PASSWORD ??= randomBytes(24).toString('base64url');
process.env.TEST_DATABASE_URL ??= `postgres://${process.env.USER ?? 'postgres'}@localhost:5432/hamham_test`;
export default defineConfig({
@@ -24,6 +53,9 @@ export default defineConfig({
DATABASE_URL: process.env.TEST_DATABASE_URL,
APP_ORIGIN: 'http://localhost:3100',
COOKIE_SECURE: 'false',
AUTH_ENCRYPTION_KEY: '12'.repeat(32),
ADMIN_EMAIL: 'admin@example.org',
NODE_EXTRA_CA_CERTS: testCert,
UPLOAD_DIR: './test-results/uploads',
NEXT_TELEMETRY_DISABLED: '1',
},