No braces

This commit is contained in:
Bob Mottram 2016-11-19 21:58:01 +00:00
parent 1b3691742e
commit dea8b96ba7
1 changed files with 5 additions and 5 deletions

View File

@ -59,14 +59,14 @@ function change_password_etherpad {
read_config_param ETHERPAD_DOMAIN_NAME
${PROJECT_NAME}-pass -u $change_username -a etherpad -p "$new_user_password"
if grep "\"\${change_username}\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"\${change_username}\": {")
if grep "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
sed -i "s|\"\${change_username}\": {.*|\"\${change_username}\": { \"password\": \"\${new_user_password}\", \"is_admin\": true }" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"password\": \"$new_user_password\", \"is_admin\": true }" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
else
sed -i "s|\"\${change_username}\": {.*|\"\${change_username}\": { \"password\": \"\${new_user_password}\", \"is_admin\": false }," /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"password\": \"$new_user_password\", \"is_admin\": false }," /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
fi
${PROJECT_NAME}-pass -u $change_username -a etherpad -p "$new_user_password"
fi
}