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>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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();
|
||||
Reference in New Issue
Block a user