Added tool to change/reset rainloop admin password

This commit is contained in:
jvolkenant 2016-07-29 16:09:03 -07:00
parent cc570975dd
commit 097e491abc
1 changed files with 46 additions and 0 deletions

46
tools/rainloop-unlockadmin.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
#
# This allows for resetting the password for
# access to Rainloop's Admin panel:
# https://yourdomain.com/mail/?admin
#
source /etc/mailinabox.conf
echo "Tool for resetting Rainloop Admin Password"
echo
echo "Password must be 8 characters or longer."
echo
echo -n "Please provide a new admin password (ctrl-c to cancel):"
read -s newpassword
echo
if [ -z $newpassword ]
then
echo "Error: Password can not be blank."
exit 1
fi
if [ ${#newpassword} -lt 8 ]
then
echo "Error: Password length must be 8 characters or longer."
exit 1
fi
echo "<?php
\$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
include '/usr/local/lib/rainloop/index.php';
\$oConfig = \RainLoop\Api::Config();
\$oConfig->SetPassword('$newpassword');
echo \$oConfig->Save() ? 'Done' : 'Error';
?>" | /usr/bin/php
echo ""
echo "Login to Rainloop Admin Panel here using your new password:"
echo "Username: admin"
echo "https://$PRIMARY_HOSTNAME/mail/?admin"