Browse Source

ee site update password command

bugfixes
harshadyeola 10 years ago
parent
commit
7dca8fe692
  1. 15
      bin/easyengine
  2. 33
      src/modules/site/update/ee_mod_site_update_password.sh

15
bin/easyengine

@ -593,6 +593,21 @@ elif [ "$EE_FIRST" = "site" ]; then
# Execute: service nginx reload
ee_lib_service nginx reload
fi
elif [ "$EE_SECOND" = "update" ]; then
# Check the website name is empty or not
EE_DOMAIN_CHECK=$EE_THIRD
EE_SITE_UPDATE_OPTION=$EE_FOURTH
ee_lib_check_domain
# Check the website exist
ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \
|| ee_lib_error "The $EE_DOMAIN is not found in /etc/nginx/sites-available, exit status = " $?
EE_SITE_CURRENT_OPTION=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION" | rev | cut -d' ' -f3,4,5,6,7 | rev | cut -d ' ' -f2,3,4,5)
if [ "$EE_SITE_UPDATE_OPTION" = "--password" ]; then
ee_mod_site_update_password
fi
elif [ "$EE_SECOND" = "log" ]; then
# Display logs for websites
ee_mod_site_log ${@:3}

33
src/modules/site/update/ee_mod_site_update_password.sh

@ -0,0 +1,33 @@
# Update WordPress user password
ee_mod_site_update_password()
{
local ee_wp_user ee_wp_pass
cd $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g') \
|| ee_lib_error "Unable to change directory for $EE_DOMAIN, exit status = " $?
wp --allow-root core version &>> /dev/null \
|| ee_lib_error "Error: $EE_DOMAIN does not seem to be a WordPress install, exit status = " $?
if [ $? -eq 0 ]; then
read -p "Provide WordPress user name [admin]: " ee_wp_user
if [[ $ee_wp_user = "" ]]; then
ee_wp_user=admin
fi
# Check WordPress user exist or not
wp --allow-root user list --fields=user_login | grep $ee_wp_user &>> /dev/null
if [ $? -eq 0 ]; then
read -sp "Provide password for $ee_wp_user user: " ee_wp_pass
echo
if [[ ${#ee_wp_pass} -ge 8 ]]; then
wp --allow-root user update $ee_wp_user --user_pass=$ee_wp_pass &>> $EE_COMMAND_LOG
else
ee_lib_error "Password Unchanged. Hint : Your password must be 8 characters long, exit status = " $?
fi
else
ee_lib_error "Invalid WordPress user $ee_wp_user for $EE_DOMAIN, exit status = " $?
fi
fi
}
Loading…
Cancel
Save