d31f783c13
- 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>
56 lines
1.4 KiB
Bash
Executable File
56 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
echo "======================================"
|
|
echo "MinIO WebUI - Reset to Default Password"
|
|
echo "======================================"
|
|
echo ""
|
|
|
|
# Default password hash for "admin123"
|
|
DEFAULT_HASH='$2b$12$LQv7c3SijBJLhSHPDOLkDe7YfPzFaXhJNXLKqFsFC37GA9xc1wSNi'
|
|
|
|
# Check if .env exists
|
|
if [ ! -f .env ]; then
|
|
echo "❌ Error: .env file not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Update the .env file
|
|
if grep -q "ADMIN_PASSWORD_HASH=" .env; then
|
|
# Replace existing hash
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
# macOS
|
|
sed -i '' "s/ADMIN_PASSWORD_HASH=.*/ADMIN_PASSWORD_HASH=$DEFAULT_HASH/" .env
|
|
else
|
|
# Linux
|
|
sed -i "s/ADMIN_PASSWORD_HASH=.*/ADMIN_PASSWORD_HASH=$DEFAULT_HASH/" .env
|
|
fi
|
|
else
|
|
# Add hash if not present
|
|
echo "ADMIN_PASSWORD_HASH=$DEFAULT_HASH" >> .env
|
|
fi
|
|
|
|
echo "✅ Password reset to default!"
|
|
echo ""
|
|
echo "Default credentials:"
|
|
echo " Username: admin"
|
|
echo " Password: admin123"
|
|
echo ""
|
|
|
|
# Restart backend if running
|
|
if docker ps | grep -q minio-webui-backend; then
|
|
if docker ps | grep -q minio-webui-backend-dev; then
|
|
CONTAINER="minio-webui-backend-dev"
|
|
else
|
|
CONTAINER="minio-webui-backend"
|
|
fi
|
|
|
|
echo "Restarting backend container..."
|
|
docker restart $CONTAINER
|
|
echo "✅ Backend restarted."
|
|
fi
|
|
|
|
echo ""
|
|
echo "You can now login with: admin / admin123"
|
|
echo "" |