feat: Add admin password management tools and debug logging

- Add setAdminPassword.js utility for setting password inside container
- Add set-admin-password.sh for easy Docker exec password setting
- Add reset-to-default-password.sh for quick testing (sets to admin123)
- Add debug logging to password verification for troubleshooting
- Improve error handling when password hash is missing

These tools make it much easier to manage the admin password without
dealing with bcrypt hash generation and .env file formatting issues.

Usage:
- Set custom password: ./scripts/set-admin-password.sh
- Reset to default: ./scripts/reset-to-default-password.sh

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-23 15:28:17 +02:00
parent 2ee293244c
commit d31f783c13
4 changed files with 196 additions and 1 deletions
+18 -1
View File
@@ -26,7 +26,24 @@ class AuthService {
async verifyPassword(password) {
try {
const isValid = await bcrypt.compare(password, config.auth.adminPasswordHash);
const hash = config.auth.adminPasswordHash;
// Debug logging in development
if (config.app.env === 'development') {
logger.debug(`Password verification debug:`, {
hashExists: !!hash,
hashLength: hash ? hash.length : 0,
hashPrefix: hash ? hash.substring(0, 7) : 'none',
passwordLength: password.length
});
}
if (!hash) {
logger.error('No admin password hash configured');
return false;
}
const isValid = await bcrypt.compare(password, hash);
return isValid;
} catch (error) {
logger.error('Password verification error:', error);