#!/bin/bash echo "=================================" echo "MinIO WebUI Password Tester" echo "=================================" echo "" # Check if .env file exists if [ ! -f .env ]; then echo "Error: .env file not found" exit 1 fi # Get the hash from .env HASH=$(grep ADMIN_PASSWORD_HASH .env | cut -d '=' -f2-) if [ -z "$HASH" ]; then echo "Error: ADMIN_PASSWORD_HASH not found in .env" exit 1 fi echo "Current hash in .env: ${HASH:0:20}..." echo "" read -s -p "Enter password to test: " PASSWORD echo "" # Test the password using Node.js in Docker docker run --rm node:20-alpine sh -c " npm install bcrypt >/dev/null 2>&1 && \ node -e \" const bcrypt = require('bcrypt'); const hash = '$HASH'; const password = '$PASSWORD'; bcrypt.compare(password, hash).then(result => { if (result) { console.log('\n✅ Password is CORRECT!'); } else { console.log('\n❌ Password is INCORRECT!'); } }).catch(err => { console.error('\n❌ Error:', err.message); }); \" " echo "" echo "================================="