#!/usr/bin/env node // Test-Script für Passwort-Verifizierung // Verwendung: node test-password.js "dein-passwort" const bcrypt = require('bcrypt'); const hash = '$2y$07$cSnPaBjKKlmtOTKtbTDTTuYQ0bZ0upNQfNWf7gf8OKiz8eEjwSGFG'; const password = process.argv[2]; if (!password) { console.error('❌ Verwendung: node test-password.js "dein-passwort"'); process.exit(1); } console.log('🔐 Teste Passwort-Verifizierung...'); console.log('Hash:', hash); console.log('Hash-Format:', hash.substring(0, 4)); console.log(''); // bcrypt.compare kann $2y$ Hashes lesen (PHP-Format) bcrypt.compare(password, hash) .then(isMatch => { if (isMatch) { console.log('✅ Passwort ist KORREKT!'); console.log(''); console.log('Das Passwort-Hashing funktioniert.'); console.log('Problem liegt woanders (z.B. Salt, Email-Matching, etc.)'); } else { console.log('❌ Passwort ist FALSCH!'); console.log(''); console.log('Entweder:'); console.log('1. Falsches Passwort eingegeben'); console.log('2. Hash wurde anders erstellt (Salt-Problem)'); console.log('3. Passwort muss neu gesetzt werden'); } }) .catch(err => { console.error('❌ Fehler beim Vergleich:', err.message); console.log(''); console.log('Mögliche Ursachen:'); console.log('- $2y$ Format wird nicht unterstützt'); console.log('- Hash ist korrupt'); });