mirror of
https://github.com/bigbeartechworld/big-bear-scripts.git
synced 2026-05-27 18:22:10 -04:00
✨🔑 feat(reset-password): Add fallback for missing user.db (#10)
* ✨🔑 feat(reset-password): Add fallback for missing user.db This change adds a fallback mechanism to handle cases where the `/var/lib/casaos/db/user.db` file is not found. If the file is missing, the script attempts to check if the file exists in an alternative location. If found, it backs up the file and restarts the CasaOS user service to ensure the password reset functionality works correctly. * 🔐 feat(reset-password-for-casaos): Remove user.db existence check and provide alternative method The changes remove the check for the existence of the `user.db` file and provide an alternative method to handle the case where the file is not found. This change is intended to make the password reset process more robust and accommodate systems where the `user.db` file may not be present.
This commit is contained in:
@@ -55,10 +55,20 @@ if [[ "${response,,}" != "y" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if user.db exists
|
||||
# For some systems, if user.db is not found
|
||||
if [[ ! -f /var/lib/casaos/db/user.db ]]; then
|
||||
echo "Error: user.db does not exist. Please ensure CasaOS is properly installed."
|
||||
exit 1
|
||||
echo "Warning: user.db not found. Attempting alternative method for some systems."
|
||||
|
||||
# Check if the file exists
|
||||
if ls /var/lib/casaos/db/user.db &> /dev/null; then
|
||||
echo "user.db found. Proceeding with backup and restart."
|
||||
sudo mv /var/lib/casaos/db/user.db /var/lib/casaos/db/user.db.backup
|
||||
sudo systemctl restart casaos-user-service.service
|
||||
echo "CasaOS user service restarted. Please check if the issue is resolved."
|
||||
else
|
||||
echo "Error: user.db still not found. Please ensure CasaOS is properly installed on your Debian system."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Backup user.db
|
||||
|
||||
Reference in New Issue
Block a user