#!/bin/sh
if [ "$#" != 1 ]; then
	cat <<EOF
Usage: $0 <new password>
EOF
	exit 1
fi
. /federated/apps/pdnsmysql/.env
. /etc/federated
NEWPASS=$(echo -n "$1" |md5sum - |cut -d' ' -f1)
docker exec -ti pdnsmysql /bin/bash -c "echo \"UPDATE wp_users SET user_pass='$NEWPASS' WHERE user_login='admin@$DOMAIN'\" | mysql -u root -p$MYSQL_ROOT_PASSWORD wordpress"
docker exec -ti pdnsmysql /bin/bash -c "echo \"SELECT user_login,user_pass FROM wp_users;\" | mysql -u root -p$MYSQL_ROOT_PASSWORD wordpress"
