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

[enh] Create user + administrator

This commit is contained in:
magikcypress 2017-04-16 16:12:21 +02:00
parent 2be310eefa
commit 8b811b7343
2 changed files with 28 additions and 3 deletions

View file

@ -110,6 +110,13 @@ SETUP_SOURCE () { # Download source, decompress and copu into $final_path
fi fi
} }
# Create user with special hack
CREATE_USER () {
sudo curl -kSs https://${domain}/auth/sign_up --cookie-jar cookie | grep csrf > token || true
token=$(sudo cat token | sed -n '/csrf-token/s/.*name="csrf-token"\s\+content="\([^"]\+\).*/\1/p')
sudo curl -kSs https://${domain}/auth --data "&user[account_attributes][username]=${admin_mastodon}&user[email]=${admin_mastodon}@${domain}&user[password]=${admin_pass}&user[password_confirmation]=${admin_pass}&authenticity_token=${token}" --cookie cookie
}
### REMOVE SCRIPT ### REMOVE SCRIPT
REMOVE_NGINX_CONF () { # Delete nginx configuration REMOVE_NGINX_CONF () { # Delete nginx configuration

View file

@ -188,8 +188,6 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Install crontab # Install crontab
sudo cp ../conf/crontab_mastodon /etc/cron.d/$app sudo cp ../conf/crontab_mastodon /etc/cron.d/$app
sudo sed -i "s@__APP__@$app@g" /etc/cron.d/$app sudo sed -i "s@__APP__@$app@g" /etc/cron.d/$app
# Restart crontab
sudo systemctl restart cron
# Private or not # Private or not
if [ "$is_public" = "Yes" ]; if [ "$is_public" = "Yes" ];
@ -209,3 +207,23 @@ sudo yunohost app ssowatconf
# Reload Nginx # Reload Nginx
sudo systemctl reload nginx sudo systemctl reload nginx
# all services start, please
sleep 30
# Mastodon need a user for creating an administator account
# rake create user is not up for the moment
# See PR: https://github.com/tootsuite/mastodon/pull/1482
CREATE_USER
# Create admin user
# Create confirm email
sudo su - $app <<ACOMMANDS
pushd ~/live
# RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=$admin_mastodon
# RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon@$domain
ACOMMANDS
# Restart crontab
sudo systemctl restart cron