die e-mail entfernt

Dieser Commit ist enthalten in:
Claude Project Manager
2025-09-29 22:00:56 +02:00
Ursprung 68a9a50227
Commit e34424bf1d
3 geänderte Dateien mit 12 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -613,7 +613,7 @@ export default function UserManagement() {
} }
function PurgeUsersPanel({ onDone }: { onDone: () => void }) { function PurgeUsersPanel({ onDone }: { onDone: () => void }) {
const [email, setEmail] = useState('hendrik.gebhardt@polizei.nrw.de') const [email, setEmail] = useState('')
const [busy, setBusy] = useState(false) const [busy, setBusy] = useState(false)
const [msg, setMsg] = useState('') const [msg, setMsg] = useState('')

Datei anzeigen

@ -29,7 +29,7 @@ async function createTestUser() {
try { try {
console.log('\n=== Creating Test User ===\n'); console.log('\n=== Creating Test User ===\n');
const email = 'hendrik.gebhardt@polizei.nrw.de'; const email = 'test.user@example.com';
const hashedPassword = await bcryptjs.hash('test123', 10); const hashedPassword = await bcryptjs.hash('test123', 10);
const encryptedEmail = encrypt(email); const encryptedEmail = encrypt(email);
const emailHash = hashEmail(email); const emailHash = hashEmail(email);
@ -40,7 +40,7 @@ async function createTestUser() {
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
`).run( `).run(
userId, userId,
'hendrik.gebhardt', 'test.user',
encryptedEmail, encryptedEmail,
emailHash, emailHash,
hashedPassword, hashedPassword,
@ -52,7 +52,7 @@ async function createTestUser() {
console.log('✓ Test user created successfully!'); console.log('✓ Test user created successfully!');
console.log('Email:', email); console.log('Email:', email);
console.log('Username: hendrik.gebhardt'); console.log('Username: test.user');
console.log('Password: test123'); console.log('Password: test123');
console.log('Role: user'); console.log('Role: user');
@ -69,4 +69,4 @@ async function createTestUser() {
} }
} }
createTestUser(); createTestUser();

Datei anzeigen

@ -1,7 +1,6 @@
// Purge users from DB, keeping only 'admin' and a specific email // Purge users from DB, keeping only 'admin' and a specific email
// Usage (Windows CMD/PowerShell from backend directory): // Usage (from backend directory):
// npm run purge-users -- --email hendrik.gebhardt@polizei.nrw.de // npm run purge-users -- --email someone@example.com
// If --email is omitted, defaults to 'hendrik.gebhardt@polizei.nrw.de'
const path = require('path') const path = require('path')
const fs = require('fs') const fs = require('fs')
@ -24,7 +23,7 @@ function hashLower(text) {
function parseEmailArg() { function parseEmailArg() {
const idx = process.argv.indexOf('--email') const idx = process.argv.indexOf('--email')
if (idx !== -1 && process.argv[idx + 1]) return process.argv[idx + 1] if (idx !== -1 && process.argv[idx + 1]) return process.argv[idx + 1]
return 'hendrik.gebhardt@polizei.nrw.de' return null
} }
function backupFile(filePath) { function backupFile(filePath) {
@ -43,6 +42,10 @@ function backupFile(filePath) {
function main() { function main() {
const dbPath = getDbPath() const dbPath = getDbPath()
const keepEmail = parseEmailArg() const keepEmail = parseEmailArg()
if (!keepEmail) {
console.error("❌ Bitte E-Mail angeben: --email someone@example.com")
process.exit(1)
}
const keepHash = hashLower(keepEmail) const keepHash = hashLower(keepEmail)
console.log(`Datenbank: ${dbPath}`) console.log(`Datenbank: ${dbPath}`)