fix: improve admin credentials display and configuration
Mirror to GitHub / mirror (push) Successful in 29s
Test and Lint / backend-test (push) Successful in 1m32s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m5s
Version and Release / version-bump (push) Successful in 42s
Version and Release / trigger-drone (push) Successful in 3s

- Display email address instead of username in migration output
- Use environment variables for admin email configuration
- Update deployment guide with clear admin setup instructions
- Add note that login requires email address, not username
- Fix GitHub URL to correct repository
- Remove obsolete version field from docker-compose.yml

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-25 16:28:16 +02:00
parent b428543452
commit ad495a92c4
3 changed files with 62 additions and 12 deletions
+10 -4
View File
@@ -18,9 +18,13 @@ exports.up = async function(knex) {
const generatedPassword = generateReadablePassword();
const passwordHash = await bcrypt.hash(generatedPassword, 12); // Increased rounds for better security
// Get admin credentials from environment or use defaults
const adminUsername = process.env.ADMIN_USERNAME || 'admin';
const adminEmail = process.env.ADMIN_EMAIL || 'admin@example.com';
await knex('admin_users').insert({
username: 'admin',
email: 'admin@example.com',
username: adminUsername,
email: adminEmail,
password_hash: passwordHash,
created_at: new Date()
});
@@ -36,7 +40,7 @@ PicPeak Admin Credentials
Your admin account has been created with these credentials:
Username: admin
Email: ${adminEmail}
Password: ${generatedPassword}
IMPORTANT SECURITY NOTES:
@@ -47,6 +51,8 @@ IMPORTANT SECURITY NOTES:
Login URL: ${process.env.ADMIN_URL || 'http://localhost:3001'}/admin
Login with the email address shown above
Generated on: ${new Date().toISOString()}
========================================
`;
@@ -65,7 +71,7 @@ Generated on: ${new Date().toISOString()}
console.log('\n========================================');
console.log('✅ Admin user created successfully!');
console.log('========================================');
console.log('Username: admin');
console.log(`Email: ${adminEmail}`);
console.log(`Password: ${generatedPassword}`);
console.log('\n⚠️ IMPORTANT:');
console.log('1. Save these credentials securely');