Browse Source

Password strength is to be enforced by the core

pull/48/head
Alexandre Aubin 6 years ago
parent
commit
421888d137
  1. 2
      config_panel.toml
  2. 8
      scripts/config
  3. 9
      scripts/install

2
config_panel.toml

@ -13,7 +13,7 @@ name = "My webapp configuration"
default = true default = true
[main.sftp.password] [main.sftp.password]
ask = "Set a password for the SFTP access. ≥ 5 character"
ask = "Set a password for the SFTP access"
type = "password" type = "password"
optional = true optional = true
help = "If a password already exist, it will not be replaced." help = "If a password already exist, it will not be replaced."

8
scripts/config

@ -119,19 +119,11 @@ apply_config() {
# Change the password only if none was already set for the user # Change the password only if none was already set for the user
if [ $is_password_exist -eq 0 ] && [ $with_sftp -eq 1 ] if [ $is_password_exist -eq 0 ] && [ $with_sftp -eq 1 ]
then then
# Check password strength
if [ ${#password} -le 5 ]
then
ynh_print_err --message="The password is too weak, it must be longer than 5 characters."
# Disable the sftp access, as the password is incorrect
yunohost app action run $app sftp --args with_sftp=0
else
# Add the password to the user # Add the password to the user
chpasswd <<< "${app}:${password}" chpasswd <<< "${app}:${password}"
ynh_app_setting_set --app=$app --key=password --value="$password" ynh_app_setting_set --app=$app --key=password --value="$password"
fi fi
fi fi
fi
#================================================= #=================================================
# RECONFIGURE PHP-FPM # RECONFIGURE PHP-FPM

9
scripts/install

@ -39,15 +39,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
if [ $with_sftp -eq 1 ]
then
# Check password strength
if [ ${#password} -le 5 ]
then
ynh_die --message="The password is too weak, it must be longer than 5 characters"
fi
fi
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url

Loading…
Cancel
Save