Files
minio-webui/backend/scripts/hash-password.js
T
paul f0f0f98208 feat: Add password hash generation scripts
- Add simple hash-password script for quick hash generation
- Add interactive generate-password script with hidden input
- Include password validation and requirements display
- Add npm scripts for easy execution
- Create comprehensive PASSWORD_GENERATION.md guide
- Use existing bcrypt infrastructure with 12 salt rounds

Usage:
  npm run hash-password YourPassword123\!
  npm run generate-password (interactive)

This solves the issue where bcrypt command line tools
don't work properly for generating compatible hashes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 08:55:53 +02:00

23 lines
601 B
JavaScript

const bcrypt = require('bcrypt');
const password = process.argv[2];
if (!password) {
console.error('Usage: npm run hash-password <your-password>');
console.error('Example: npm run hash-password MySecurePass123!');
process.exit(1);
}
async function hashPassword() {
try {
const hash = await bcrypt.hash(password, 12);
console.log('\n=== Generated Password Hash ===');
console.log(`ADMIN_PASSWORD_HASH=${hash}`);
console.log('\nCopy the above line to your .env file');
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}
}
hashPassword();