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. 14
      scripts/config
  3. 9
      scripts/install

2
config_panel.toml

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

14
scripts/config

@ -119,17 +119,9 @@ apply_config() {
# Change the password only if none was already set for the user
if [ $is_password_exist -eq 0 ] && [ $with_sftp -eq 1 ]
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
chpasswd <<< "${app}:${password}"
ynh_app_setting_set --app=$app --key=password --value="$password"
fi
# Add the password to the user
chpasswd <<< "${app}:${password}"
ynh_app_setting_set --app=$app --key=password --value="$password"
fi
fi

9
scripts/install

@ -39,15 +39,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
final_path=/var/www/$app
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
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url

Loading…
Cancel
Save