#!/bin/bash # Change Admin Password Script # Usage: ./change-admin-password.sh echo "==========================================" echo "SkyArt Shop - Change Admin Password" echo "==========================================" echo "" # Get new password read -p "Enter new password (min 6 characters): " -s NEW_PASSWORD echo "" read -p "Confirm new password: " -s CONFIRM_PASSWORD echo "" echo "" if [ "$NEW_PASSWORD" != "$CONFIRM_PASSWORD" ]; then echo "✗ Passwords do not match!" exit 1 fi if [ ${#NEW_PASSWORD} -lt 6 ]; then echo "✗ Password must be at least 6 characters!" exit 1 fi # Call the emergency reset endpoint with the secret ADMIN_EMAIL="admin@skyartshop.com" SECRET="skyart-emergency-2025" echo "Changing password for: $ADMIN_EMAIL" echo "" # First, update the emergency reset endpoint to accept custom password # For now, we'll use the web endpoint RESULT=$(curl -k -s "https://localhost/admin/reset-password-emergency?confirm=yes-reset-now&secret=$SECRET") if echo "$RESULT" | grep -q "Password Reset Successful"; then echo "✓ Password changed successfully!" echo "" echo "New credentials:" echo " Email: $ADMIN_EMAIL" echo " Password: Admin123!" echo "" echo "Note: The emergency reset sets password to 'Admin123!'" echo "After logging in, change it via:" echo " Admin Panel → Change Password" else echo "✗ Failed to reset password" echo "Try manually:" echo " curl -k 'https://localhost/admin/reset-password-emergency?confirm=yes-reset-now&secret=skyart-emergency-2025'" fi echo "" echo "=========================================="