1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ghost_ynh.git synced 2024-09-03 19:16:02 +02:00

add sleep to fix admin registration

This commit is contained in:
Julien Malik 2014-03-25 09:04:28 +01:00
parent ebadcea5fc
commit 935bd6a666

View file

@ -104,25 +104,19 @@ sudo service nginx reload
sudo yunohost app ssowatconf
echo "Registering admin..."
# echo "127.0.0.1 $domain #ynhghost" | sudo tee -a /etc/hosts
sleep 5
admin_name=$(sudo yunohost user list | python ../conf/user_getname.py $admin)
admin_mail=$(sudo yunohost user list | python ../conf/user_getmail.py $admin)
curl -kL -X GET https://$domain$path/ghost/signup --cookie-jar cookie.txt > signup_get
#echo "signup_get"
#cat signup_get
sleep 5
csrf_token=$(cat signup_get | egrep csrf-param | egrep "content=\".+\"" -o | egrep "\".+\"" -o | cut -d '"' -f 2)
#echo "csrf_token"
#echo $csrf_token
#echo "POST"
curl -kL -X POST https://$domain$path/ghost/signup/ \
--cookie cookie.txt --header "X-CSRF-Token: $csrf_token" \
--data-urlencode "name=$admin_name" \
--data-urlencode "email=$admin_mail" \
--data-urlencode "password=$password"
#echo "done curl"
--data-urlencode "password=$password" \
> /dev/null 2>&1
sudo yunohost app setting ghostblog admin -v $admin
sudo yunohost app setting ghostblog password -v $password
#sudo sed -i '/ynhghost/d' /etc/hosts
echo "Success ! You can go to https://$domain$path/ghost to write your posts"