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

fix ldap user

This commit is contained in:
yalh76 2019-03-23 02:28:48 +01:00
parent ff2fea8ef2
commit 652d6f6c67
2 changed files with 4 additions and 14 deletions

View file

@ -181,7 +181,6 @@ ynh_replace_string "__OTP_SECRET__" "$otp_secret" "$final_path/live/.env.product
ynh_app_setting_set "$app" otp_secret "$otp_secret" ynh_app_setting_set "$app" otp_secret "$otp_secret"
ldap_user="${app}ldap" ldap_user="${app}ldap"
ynh_user_exists $ldap_user || ynh_die "LDAP User $ldap_user already exist"
ldap_password=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128) ldap_password=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
yunohost user create username -f $ldap_user -l $ldap_user -m $app@$domain -p $ldap_password -q 0 yunohost user create username -f $ldap_user -l $ldap_user -m $app@$domain -p $ldap_password -q 0
ynh_replace_string "__LDAP_USER__" "$ldap_user" "${final_path}/live/.env.production" ynh_replace_string "__LDAP_USER__" "$ldap_user" "${final_path}/live/.env.production"

View file

@ -89,9 +89,10 @@ fi
# If ldap_password doesn't exist, retrieve it or create it # If ldap_password doesn't exist, retrieve it or create it
if [[ -z "$ldap_user" ]]; then if [[ -z "$ldap_user" ]]; then
ynh_user_exists $ldap_user || ynh_die "LDAP User $app already exist" ldap_user="${app}ldap"
ynh_user_exists $ldap_user || ynh_die "LDAP User $ldap_user already exist"
ldap_password=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128) ldap_password=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
yunohost user create username f $app -l $app -m $app@$domain -p $ldap_password -q 0 yunohost user create username -f $ldap_user -l $ldap_user -m $app@$domain -p $ldap_password -q 0
ynh_app_setting_set "$app" ldap_user "$ldap_user" ynh_app_setting_set "$app" ldap_user "$ldap_user"
ynh_app_setting_set "$app" ldap_password "$ldap_password" ynh_app_setting_set "$app" ldap_password "$ldap_password"
fi fi
@ -204,24 +205,14 @@ ynh_replace_string "__SMTP_FROM_ADDRESS__" "$admin_mail" "${final_path}/l
language="$(echo $language | head -c 2)" language="$(echo $language | head -c 2)"
ynh_replace_string "__LANGUAGE__" "$language" "$final_path/live/.env.production" ynh_replace_string "__LANGUAGE__" "$language" "$final_path/live/.env.production"
paperclip_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
ynh_replace_string "PAPERCLIP_SECRET=" "PAPERCLIP_SECRET=$paperclip_secret" "${final_path}/live/.env.production" ynh_replace_string "PAPERCLIP_SECRET=" "PAPERCLIP_SECRET=$paperclip_secret" "${final_path}/live/.env.production"
ynh_app_setting_set "$app" paperclip_secret "$paperclip_secret"
secret_key_base=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
ynh_replace_string "__SECRET_KEY_BASE__" "$secret_key_base" "$final_path/live/.env.production" ynh_replace_string "__SECRET_KEY_BASE__" "$secret_key_base" "$final_path/live/.env.production"
ynh_app_setting_set "$app" secret_key_base "$secret_key_base"
otp_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
ynh_replace_string "__OTP_SECRET__" "$otp_secret" "$final_path/live/.env.production" ynh_replace_string "__OTP_SECRET__" "$otp_secret" "$final_path/live/.env.production"
ynh_app_setting_set "$app" otp_secret "$otp_secret"
ynh_user_exists $app || ynh_die "LDAP User $app already exist" ynh_replace_string "__LDAP_USER__" "$ldap_user" "${final_path}/live/.env.production"
ldap_password=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
yunohost user create username f $app -l $app -m $app@$domain -p $ldap_password -q 0
ynh_replace_string "__APP__" "$app" "${final_path}/live/.env.production"
ynh_replace_string "__LDAP_PASSWORD__" "$ldap_password" "${final_path}/live/.env.production" ynh_replace_string "__LDAP_PASSWORD__" "$ldap_password" "${final_path}/live/.env.production"
ynh_app_setting_set "$app" ldap_password "$ldap_password"
#================================================= #=================================================
# UPGRADE MASTODON # UPGRADE MASTODON