1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/my_webapp_ynh.git synced 2024-09-03 19:46:26 +02:00

Password strength is to be enforced by the core

This commit is contained in:
Alexandre Aubin 2020-06-17 16:09:30 +02:00
parent 3e34a7e69d
commit 421888d137
3 changed files with 4 additions and 21 deletions

View file

@ -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."

View file

@ -119,19 +119,11 @@ 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
fi
fi
#=================================================
# RECONFIGURE PHP-FPM

View file

@ -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