diff --git a/config_panel.toml b/config_panel.toml index c9fcad5..d86d79c 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -4,19 +4,23 @@ version = "1.0" name = "My Webapp configuration" [main.sftp] - name = "SFTP access" + name.en = "SFTP access" + name.fr = "Accès SFTP" [main.sftp.with_sftp] - ask = "Do you need a SFTP access?" + ask.en = "Do you need a SFTP access?" + ask.fr = "Avez-vous besoin d'un accès SFTP ?" type = "boolean" default = true [main.sftp.password] - ask = "Set a password for the SFTP access" + ask.en = "Set a password for the SFTP access" + ask.fr = "Définir un mot de passe pour l’accès SFTP" type = "password" optional = true visible = "with_sftp" - help = "If a password already exist, leave blank and it will not be replaced." + help.en = "If a password already exist, leave blank and it will not be replaced." + help.fr = "Si un mot de passe existe déjà, laissez vide et il ne sera pas remplacé." [main.code_error] name = "Html Custom error" diff --git a/scripts/config b/scripts/config index 1ff9b49..771b610 100644 --- a/scripts/config +++ b/scripts/config @@ -59,7 +59,7 @@ get__free_footprint() { #================================================= set__password() { - if [ "$password" == "" ] + if [ ! "$password" == "" ] then ynh_app_setting_set --app=$app --key=password --value="$password" fi @@ -150,6 +150,11 @@ ynh_app_config_apply() { then ynh_system_user_del_group --username=$app --groups="sftp.app" fi + + if [ "${changed[password]}" == "true" ] && [ ! "$password" == "" ] + then + chpasswd <<< "${app}:${password}" + fi if [ "${changed[custom_error_file]}" == "true" ] then