Changing the dokuwki password

This commit is contained in:
Bob Mottram 2016-11-20 14:15:52 +00:00
parent 082e151a35
commit 232cb7fbf0
1 changed files with 19 additions and 7 deletions

View File

@ -41,11 +41,11 @@ DOKUWIKI_CODE=
DOKUWIKI_ONION_PORT=8089
dokuwiki_variables=(ONION_ONLY
MY_USERNAME
DOKUWIKI_TITLE
DOKUWIKI_DOMAIN_NAME
DOKUWIKI_CODE
DDNS_PROVIDER)
MY_USERNAME
DOKUWIKI_TITLE
DOKUWIKI_DOMAIN_NAME
DOKUWIKI_CODE
DDNS_PROVIDER)
function install_interactive_dokuwiki {
if [[ $ONION_ONLY != "no" ]]; then
@ -61,8 +61,20 @@ function install_interactive_dokuwiki {
}
function change_password_dokuwiki {
echo -n ''
#${PROJECT_NAME}-pass -u $1 -a dokuwiki -p "$2"
curr_username="$1"
new_user_password="$2"
if grep "$curr_username:" /var/lib/dokuwiki/acl/users.auth.php; then
HASHED_DOKUWIKI_PASSWORD=$(echo -n "$new_user_password" | md5sum | awk -F ' ' '{print $1}')
existing_user=$(cat /var/lib/dokuwiki/acl/users.auth.php | grep "$curr_username:" | hean -n 1)
if [[ "$existing_user" == *":admin,"* ]]; then
sed -i "s|$curr_username:.*|$curr_username:$HASHED_DOKUWIKI_PASSWORD:$curr_username:$curr_username@$HOSTNAME:admin,user,upload|g" /var/lib/dokuwiki/acl/users.auth.php
else
sed -i "s|$curr_username:.*|$curr_username:$HASHED_DOKUWIKI_PASSWORD:$curr_username:$curr_username@$HOSTNAME:user,upload|g" /var/lib/dokuwiki/acl/users.auth.php
fi
chmod 640 /var/lib/dokuwiki/acl/users.auth.php
${PROJECT_NAME}-pass -u $curr_username -a dokuwiki -p "$new_user_password"
fi
}
function reconfigure_dokuwiki {