1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/webtrees_ynh.git synced 2024-09-03 18:26:37 +02:00

Fix semantics + the password hash wasnt random + the admin password has to be saved as a setting to be displayed in the postinstall notification

This commit is contained in:
Alexandre Aubin 2023-07-30 16:49:26 +02:00
parent 09e8790435
commit 4326341df5
4 changed files with 7 additions and 6 deletions

View file

@ -1,3 +1,3 @@
INSERT INTO `wt_user` (`user_id`, `user_name`, `real_name`, `email`, `password`) VALUES (NULL, '__USER_NAME__', '__NAME__', '__USER_EMAIL__', '__PASSWORD__'); INSERT INTO `wt_user` (`user_id`, `user_name`, `real_name`, `email`, `password`) VALUES (NULL, '__USER_NAME__', '__NAME__', '__USER_EMAIL__', '__ADMIN_PASSWORD__');
INSERT INTO `wt_user_setting` (`user_id`, `setting_name`, `setting_value`) VALUES ('1', 'canadmin', '1'), ('1', 'verified', '1'), ('1', 'verified_by_admin', '1'); INSERT INTO `wt_user_setting` (`user_id`, `setting_name`, `setting_value`) VALUES ('1', 'canadmin', '1'), ('1', 'verified', '1'), ('1', 'verified_by_admin', '1');

View file

@ -1,4 +1,4 @@
Your credentials for the admin panel are: Your credentials for the admin panel are:
- admin username: __ADMIN_USERNAME__ - admin username: __ADMIN_USERNAME__
- admin password: __PASSWORD__ - admin password: __ADMIN_PASSWORD__

View file

@ -1,4 +1,4 @@
Vos informations d'identification pour le panneau d'administration sont : Vos informations d'identification pour le panneau d'administration sont :
- nom d'utilisateur administrateur : __ADMIN_USERNAME__ - nom d'utilisateur administrateur : __ADMIN_USERNAME__
- mot de passe administrateur : __PASSWORD__ - mot de passe administrateur : __ADMIN_PASSWORD__

View file

@ -13,8 +13,8 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
password=$(ynh_string_random 24) admin_password=$(ynh_string_random 24)
admin_password=$(openssl passwd -1 -salt xyz $password) admin_password_hashed=$(mkpasswd -m md5crypt --stdin <<< "$admin_password")
admin_username=$YNH_APP_ARG_USERNAME admin_username=$YNH_APP_ARG_USERNAME
admin_name=$YNH_APP_ARG_NAME admin_name=$YNH_APP_ARG_NAME
admin_email=$YNH_APP_ARG_EMAIL admin_email=$YNH_APP_ARG_EMAIL
@ -22,6 +22,7 @@ admin_email=$YNH_APP_ARG_EMAIL
ynh_app_setting_set --app=$app --key=admin_username --value=$admin_username ynh_app_setting_set --app=$app --key=admin_username --value=$admin_username
ynh_app_setting_set --app=$app --key=admin_name --value=$admin_name ynh_app_setting_set --app=$app --key=admin_name --value=$admin_name
ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email
ynh_app_setting_set --app=$app --key=admin_password --value=$admin_password
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -65,7 +66,7 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/webtrees.sql
ynh_replace_string --match_string="__USER_NAME__" --replace_string="$admin_username" --target_file="../conf/sql/admin.sql" ynh_replace_string --match_string="__USER_NAME__" --replace_string="$admin_username" --target_file="../conf/sql/admin.sql"
ynh_replace_string --match_string="__NAME__" --replace_string="$admin_name" --target_file="../conf/sql/admin.sql" ynh_replace_string --match_string="__NAME__" --replace_string="$admin_name" --target_file="../conf/sql/admin.sql"
ynh_replace_string --match_string="__USER_EMAIL__" --replace_string="$admin_email" --target_file="../conf/sql/admin.sql" ynh_replace_string --match_string="__USER_EMAIL__" --replace_string="$admin_email" --target_file="../conf/sql/admin.sql"
ynh_replace_string --match_string="__PASSWORD__" --replace_string="$admin_password" --target_file="../conf/sql/admin.sql" ynh_replace_string --match_string="__ADMIN_PASSWORD_HASHED__" --replace_string="$admin_password_hashed" --target_file="../conf/sql/admin.sql"
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/admin.sql" ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/admin.sql"