Add email functionality to AuthService; implement password reset email feature with nodemailer, including transporter initialization and email template for user notifications.

This commit is contained in:
Torsten Schulz (local)
2025-10-19 12:58:06 +02:00
parent 31d5d95a78
commit 2fa84d88be
5 changed files with 522 additions and 0 deletions

45
backend/test-password.js Normal file
View File

@@ -0,0 +1,45 @@
#!/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');
});