1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/aeneria_ynh.git synced 2024-09-03 18:06:15 +02:00

fix password at user configuration

This commit is contained in:
OniriCorpe 2024-01-08 19:37:36 +01:00
parent f215c960b0
commit 66ad858105
6 changed files with 41 additions and 21 deletions

8
doc/POST_INSTALL.md Normal file
View file

@ -0,0 +1,8 @@
Æneria is now installed!
You can access it here: <__PATH__>
Your login is: `__MAIL__`
Your password is: `__DEFAULT_PASSWORD__`
Please change this generated default password in the æneria settings.

8
doc/POST_INSTALL_fr.md Normal file
View file

@ -0,0 +1,8 @@
Æneria est désormais installé !
Vous pouvez y accéder à cette adresse : <__PATH__>
Votre identifiant : `__MAIL__`
Votre mot de passe : `__DEFAULT_PASSWORD__`
Merci de changer ce mot de passe généré par défaut dans les paramètres de æneria.

View file

@ -19,8 +19,8 @@
generate_random_minutes_hour () { generate_random_minutes_hour () {
minutes="$(ynh_string_random --length=1 --filter=0-5)$(ynh_string_random --length=1 --filter=0-9)" minutes="$(ynh_string_random --length=1 --filter=0-5)$(ynh_string_random --length=1 --filter=0-9)"
hour="$(ynh_string_random --length=1 --filter=0-2)" hour="$(ynh_string_random --length=1 --filter=0-2)"
ynh_app_setting_set --app=$app --key=minutes --value=$minutes ynh_app_setting_set --app="$app" --key=minutes --value="$minutes"
ynh_app_setting_set --app=$app --key=hour --value=$hour ynh_app_setting_set --app="$app" --key=hour --value="$hour"
} }
#================================================= #=================================================
@ -46,7 +46,7 @@ ynh_smart_mktemp () {
# Check if there's enough free space in a directory # Check if there's enough free space in a directory
is_there_enough_space () { is_there_enough_space () {
local free_space=$(df --output=avail "$1" | sed 1d) local free_space=$(df --output=avail "$1" | sed 1d)
test $free_space -ge $min_size test "$free_space" -ge $min_size
} }
if is_there_enough_space /tmp; then if is_there_enough_space /tmp; then

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
deskey=$(ynh_string_random --length=24) deskey=$(ynh_string_random --length=24)
ynh_app_setting_set --app=$app --key=deskey --value=$deskey ynh_app_setting_set --app="$app" --key=deskey --value="$deskey"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -25,7 +25,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
@ -56,12 +56,14 @@ chmod 600 "$install_dir/.env"
ynh_script_progression --message="Installing aeneria..." --weight=1 ynh_script_progression --message="Installing aeneria..." --weight=1
# Install aeneria # Install aeneria
pushd $install_dir pushd "$install_dir"
ynh_exec_as $app php$phpversion bin/console aeneria:install "$app" -n ynh_exec_as "$app" "php$phpversion" bin/console aeneria:install "$app" -n
# Create admin user # Create admin user
mail=$(ynh_user_get_info --username="$admin" --key='mail') mail=$(ynh_user_get_info --username="$admin" --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$(ynh_string_random)" -n default_password="$(ynh_string_random)"
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail" ynh_app_setting_set --app="$app" --key=default_password --value="$default_password"
ynh_exec_as "$app" "php$phpversion" bin/console aeneria:user:add "$mail" "$default_password" -n
ynh_exec_as "$app" "php$phpversion" bin/console aeneria:user:grant "$mail"
popd popd
#================================================= #=================================================

View file

@ -18,14 +18,14 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# RESTORE THE PSQL DATABASE # RESTORE THE PSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the PSQL database..." --weight=1 ynh_script_progression --message="Restoring the PSQL database..." --weight=1
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
@ -48,7 +48,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -55,7 +55,7 @@ then
fi fi
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
@ -90,21 +90,23 @@ chmod 600 "$install_dir/.env"
ynh_script_progression --message="Upgrading $app..." --weight=1 ynh_script_progression --message="Upgrading $app..." --weight=1
# Install dependencies and aeneria # Install dependencies and aeneria
pushd $install_dir pushd "$install_dir"
ynh_exec_as $app php$phpversion bin/console cache:clear -n ynh_exec_as "$app" "php$phpversion" bin/console cache:clear -n
ynh_exec_as $app php$phpversion bin/console doctrine:migrations:migrate -n ynh_exec_as "$app" "php$phpversion" bin/console doctrine:migrations:migrate -n
# Set admin user # Set admin user
mail=$(ynh_user_get_info --username="$admin" --key='mail') mail=$(ynh_user_get_info --username="$admin" --key='mail')
user_exists=$(ynh_exec_as $app php$phpversion bin/console aeneria:user:exist "$mail") user_exists=$(ynh_exec_as "$app" "php$phpversion" bin/console aeneria:user:exist "$mail")
if [ $user_exists -eq 0 ] if [ "$user_exists" -eq 0 ]
then then
user_pass=$(ynh_string_random) default_password=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass" -n ynh_app_setting_set --app="$app" --key=default_password --value="$default_password"
ynh_exec_as "$app" "php$phpversion" bin/console aeneria:user:add "$mail" "$default_password" -n
ynh_print_info --message="An æneria user as been created. Your login: $mail Your password: $default_password"
fi fi
# Regenerate RSA keys # Regenerate RSA keys
ynh_exec_as $app php$phpversion bin/console aeneria:generate-key --force -n ynh_exec_as "$app" "php$phpversion" bin/console aeneria:generate-key --force -n
popd popd
#================================================= #=================================================