Files
linux-8.2/reset-password.sh
2024-12-12 00:20:41 +02:00

19 lines
780 B
Bash
Executable File

#!/bin/bash
# Prompt for confirmation
echo "Are you sure you want to reset the admin password? (y/yes to confirm)"
read -r confirmation
if [[ "$confirmation" == "y" || "$confirmation" == "yes" ]]; then
echo "Proceeding with password reset..."
source /var/lib/docker/volumes/callabacloud-pass/_data/pass.txt
# Set the default password
NEW_PASSWORD='$2b$10$gJFKDTOstLTSF4wJF.uGbeBUhm0vBm7KlDraOkAFcdsq1YrEvk.ca'
# Update the password in MongoDB
MONGO_COMMAND="db.usermodel.updateOne({ email : 'admin' }, { \$set: { password : '${NEW_PASSWORD}' } });"
docker exec callabacloud-mongo mongo peers -u peersUser -p "$PEERSPASS" --eval "${MONGO_COMMAND}"
echo "Password has been reset to the default: 'password'."
else
echo "Operation cancelled."
fi